<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linux, Open Source and Web 2.0 &#187; Shell Scripting</title>
	<atom:link href="http://www.itecsoftware.com/category/shell-scripting/feed" rel="self" type="application/rss+xml" />
	<link>http://www.itecsoftware.com</link>
	<description>Itec Software</description>
	<lastBuildDate>Wed, 16 Nov 2011 02:18:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Install ffmpeg on Mac Snow Leopard</title>
		<link>http://www.itecsoftware.com/install-ffmpeg-on-mac-snow-leopard?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=install-ffmpeg-on-mac-snow-leopard</link>
		<comments>http://www.itecsoftware.com/install-ffmpeg-on-mac-snow-leopard#comments</comments>
		<pubDate>Mon, 24 Jan 2011 23:23:35 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[faac]]></category>
		<category><![CDATA[faad]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[lame]]></category>
		<category><![CDATA[ogg]]></category>
		<category><![CDATA[theora]]></category>
		<category><![CDATA[vorbis]]></category>
		<category><![CDATA[webm]]></category>
		<category><![CDATA[yasm]]></category>

		<guid isPermaLink="false">http://articles.itecsoftware.com/?p=645</guid>
		<description><![CDATA[<a href="http://www.itecsoftware.com/install-ffmpeg-on-mac-snow-leopard" title="Install ffmpeg on Mac Snow Leopard"></a>Ffmpeg is the de-facto open source standard for encoding audio and video. Especially with the arrival of html5 which uses codecs like Ogg, Theora, Vorbis, h264, webm among others, and the increasing popularity of devices from Apple, such as iPod, &#8230;<p class="read-more"><a href="http://www.itecsoftware.com/install-ffmpeg-on-mac-snow-leopard">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.itecsoftware.com/install-ffmpeg-on-mac-snow-leopard" title="Install ffmpeg on Mac Snow Leopard"></a><!-- google_ad_section_start --><p><a href="http://www.itecsoftware.com/wp-content/uploads/2011/01/webm.jpg"><img class="alignleft size-full wp-image-649" title="webm" src="http://www.itecsoftware.com/wp-content/uploads/2011/01/webm.jpg" alt="Webm" width="200" height="126" /></a>Ffmpeg is the de-facto open source standard for encoding audio and video. Especially with the arrival of html5 which uses codecs like Ogg, Theora, Vorbis, h264, webm among others, and the increasing popularity of devices from Apple, such as iPod, iPad and the iPhone, all of which require a different standard from flv, the version so widely in use by Adobe Flash.</p>
<p>Another positive aspect is that ffmpeg has a much revived developer group, posed to enhance the application on a much faster pace than it has been in recent years.</p>
<p>Installation on Linux systems is really straight forward, especially on common distro&#8217;s like Ubunty and Fedora. On a Mac, we will have to build it from source (if you&#8217;re not a fan of ports like me), including encoder/decoders we plan to use. Here is the breakdown to get ffmpeg installed on a Mac running Snow Leopard.</p>
<h4>Install Git</h4>
<p>If you don&#8217;t have Git installed, download the Git installer <a href="http://code.google.com/p/git-osx-installer/downloads/list?can=3&amp;q=&amp;sort=-uploaded&amp;colspec=Filename+Summary+Uploaded+Size+DownloadCount" target="_blank">here</a>, install the package and run the script in the source of the mounted image. CVS is included in XCode and that is located on the snow leopard installation disc.</p>
<h4>Install LAME (latest version from cvs)</h4>
<pre><span style="color: #008000;">cd ~
cvs -d:pserver:anonymous@lame.cvs.sourceforge.net:/cvsroot/lame login
(at the password prompt, press Enter)
cvs -z3 -d:pserver:anonymous@lame.cvs.sourceforge.net:/cvsroot/lame co -P lame
cd lame
./configure
make
sudo make install</span></pre>
<p><span id="more-645"></span></p>
<h4>Install FAAC and FAAD</h4>
<pre><span style="color: #008000;">cd ~
wget http://sourceforge.net/projects/faac/files/faac-src/faac-1.28/ \
  faac-1.28.tar.gz/download
tar xzvf faac-1.28.tar.gz
cd faac-1.28
./configure --with-libmp4v2
sudo make install

cd ~
wget http://sourceforge.net/projects/faac/files/faad2-src/faad2-2.7/ \
  faad2-2.7.tar.gz/download
tar xzvf faad2-2.7.tar.gz
cd faad2-2.7
./configure
make
sudo make install
</span></pre>
<h4>Install Yasm (for faster encoding)</h4>
<pre><span style="color: #008000;">cd ~
wget http://www.tortall.net/projects/yasm/releases/yasm-1.1.0.tar.gz
tar xzvf yasm-1.1.0.tar.gz
cd yasm-1.1.0
./configure
make
sudo make install
</span></pre>
<h4>Install Ogg, Vorbis and Theora</h4>
<pre><span style="color: #008000;">cd ~
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.4.tar.gz
tar xzvf libogg-1.1.4.tar.gz
cd libogg-1.1.4
./configure
make
sudo make install</span></pre>
<pre><span style="color: #008000;">
cd ~
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.3.tar.gz
tar xzvf libvorbis-1.2.3.tar.gz
cd libvorbis-1.2.3
./configure
make
sudo make install</span></pre>
<pre><span style="color: #008000;">
cd ~
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
tar xzvf libtheora-1.1.1.tar.bz2
cd libtheora-1.1.1
./configure
make
sudo make install
</span></pre>
<h4>Install ffmpeg</h4>
<pre><span style="color: #008000;">cd ~
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc \ 
--enable-pthreads --enable-libfaac --enable-libfaad2 --enable-libmp3lame \ 
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora \
--enable-libx264 --enable-libxvid --enable-x11grab --enable-libvpx-vp8</span></pre>
<h4>Note</h4>
<p>As this article matures so will new versions of the above extensions become available. Especially webm will undoubtedly see a rapid development during the coming months and you should ensure that you use the latest versions of each.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.itecsoftware.com/install-ffmpeg-on-mac-snow-leopard/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Access Dropbox From Linux Server Command Line</title>
		<link>http://www.itecsoftware.com/access-dropbox-from-linux-server-command-line?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=access-dropbox-from-linux-server-command-line</link>
		<comments>http://www.itecsoftware.com/access-dropbox-from-linux-server-command-line#comments</comments>
		<pubDate>Mon, 27 Dec 2010 20:52:05 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[dropbox]]></category>

		<guid isPermaLink="false">http://articles.itecsoftware.com/?p=628</guid>
		<description><![CDATA[<a href="http://www.itecsoftware.com/access-dropbox-from-linux-server-command-line" title="Access Dropbox From Linux Server Command Line"></a>Sharing files between VM&#8217;s can be a pain, especially if your VM is running on a text based server without UI. For example, I start up a new VM for almost anything and I deal with up to 20 different &#8230;<p class="read-more"><a href="http://www.itecsoftware.com/access-dropbox-from-linux-server-command-line">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.itecsoftware.com/access-dropbox-from-linux-server-command-line" title="Access Dropbox From Linux Server Command Line"></a><!-- google_ad_section_start --><p><a href="http://www.itecsoftware.com/wp-content/uploads/2010/12/dropbox.png"><img class="alignleft size-full wp-image-629" title="dropbox" src="http://www.itecsoftware.com/wp-content/uploads/2010/12/dropbox.png" alt="Dropbox" width="170" height="150" /></a>Sharing files between VM&#8217;s can be a pain, especially if your VM is running on a text based server without UI. For example, I start up a new VM for almost anything and I deal with up to 20 different sites and application and every one has it&#8217;s own VM.</p>
<p>VMWare provides it&#8217;s &#8220;Guest Additions&#8221; and that includes folder sharing. It works fine on desktop os&#8217;s, but on the command line we have to mount it using VMWare&#8217;s file system, which can be a bit cumbersome. A much simpler and easier way to share files is via USB or DropBox. Getting the DropBox sync daemon to run is really easy and once running, anything you add to DropBox will be synced to your VM transparently and at network speed.</p>
<p>If you don&#8217;t already have a DropBox account setup, get a <a href="http://www.dropbox.com/" target="_blank">free one here</a>. Now on to the steps to get the sync daemon up and running.</p>
<h4>Steps:</h4>
<p>SSH to your Linux server and change to your home directory.<br />
<span style="color: #008000;">cd ~</span><br />
for 32-bit os:<br />
<span style="color: #008000;">wget -O dropbox.tar.gz &#8220;http://www.dropbox.com/download/?plat=lnx.x86&#8243;</span><br />
for 64-bit os:<br />
<span style="color: #008000;">wget -O dropbox.tar.gz &#8220;http://www.dropbox.com/download/?plat=lnx.x86_64&#8243;</span><br />
After the file &#8220;dropbox.tar.gz&#8221; downloaded properly, then extract it<br />
<span style="color: #008000;">tar -xvzf dropbox.tar.gz</span><span id="more-628"></span><br />
Run dropboxd<br />
<span style="color: #008000;">~/.dropbox-dist/dropboxd</span><br />
The following error message is expected: This client is not linked to any account&#8230;<br />
Please visit https://www.dropbox.com/cli_link?host_id=123456789qwertyuiop to link this machine.</p>
<p>Copy / paste this url into the browser of your desktop machine and log in. This is the process of where your VM will be authorized and added to the account. Once completed, the daemon dropboxd should have created a ~/Dropbox folder and synchronize your files.</p>
<h4>Note:</h4>
<p>If you want to change the account it is linked to, unlink it from the first account, then kill the running dropbox process, start it up again (with &#8220;~/.dropbox-dist/dropboxd &amp;&#8221;) and obtain the new host_id with dbreadconfig.py . If you don&#8217;t restart the dropbox client, it will give the same host_id (which for some reason cause me to be unable to change the account it is linked to).</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.itecsoftware.com/access-dropbox-from-linux-server-command-line/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fix for Mac OS 10.6.5  apachectl: line 82: ulimit</title>
		<link>http://www.itecsoftware.com/fix-for-mac-os-10-6-5-apachectl-line-82-ulimit?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fix-for-mac-os-10-6-5-apachectl-line-82-ulimit</link>
		<comments>http://www.itecsoftware.com/fix-for-mac-os-10-6-5-apachectl-line-82-ulimit#comments</comments>
		<pubDate>Fri, 19 Nov 2010 19:56:37 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[apachectl]]></category>

		<guid isPermaLink="false">http://articles.itecsoftware.com/?p=600</guid>
		<description><![CDATA[<a href="http://www.itecsoftware.com/fix-for-mac-os-10-6-5-apachectl-line-82-ulimit" title="Fix for Mac OS 10.6.5  apachectl: line 82: ulimit"></a>Mac OS 10.6.5 + apachectl: /usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument After the upgrade to Mac OS 10.6.5 a bug seem to have snuck in where apachectl tries to re-set ulimit to unlimited. The error &#8230;<p class="read-more"><a href="http://www.itecsoftware.com/fix-for-mac-os-10-6-5-apachectl-line-82-ulimit">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.itecsoftware.com/fix-for-mac-os-10-6-5-apachectl-line-82-ulimit" title="Fix for Mac OS 10.6.5  apachectl: line 82: ulimit"></a><!-- google_ad_section_start --><h4>Mac OS 10.6.5 + apachectl: /usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument</h4>
<p>After the upgrade to Mac OS 10.6.5 a bug seem to have snuck in where apachectl tries to re-set ulimit to unlimited. The error appears as such:</p>
<h4>/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument</h4>
<p>While apachectl was working flawless before the upgrade to Mac OS 10.6.5, I suspected the two were related. After a quick search into what the update entailed, I found that Apple upgraded to Apache 2.2.15, which in turn patched a number of <a href="http://support.apple.com/kb/HT4435" target="_blank">vulnerabilities</a>. As it turned out, one of those changes broke the apachectl script.</p>
<p>Referring to line 82 of apachectl, the shell script was referring to the ULIMIT_MAX_FILES variable that was trying to set to unlimited, which read:</p>
<pre style="margin-bottom: 10px;">ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"</pre>
<p>Changing the line as follows fixed the problem:</p>
<pre style="margin-bottom: 10px;">ULIMIT_MAX_FILES="ulimit -S -n 1024"</pre>
<p>Should you be running a high amount of vhosts or do some testing that requires a significant amount of file descriptors, set this number higher accordingly.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.itecsoftware.com/fix-for-mac-os-10-6-5-apachectl-line-82-ulimit/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setup Puppet to configure your network servers</title>
		<link>http://www.itecsoftware.com/setup-puppet-to-configure-your-servers?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=setup-puppet-to-configure-your-servers</link>
		<comments>http://www.itecsoftware.com/setup-puppet-to-configure-your-servers#comments</comments>
		<pubDate>Tue, 16 Nov 2010 22:30:16 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[puppet]]></category>

		<guid isPermaLink="false">http://articles.itecsoftware.com/?p=574</guid>
		<description><![CDATA[<a href="http://www.itecsoftware.com/setup-puppet-to-configure-your-servers" title="Setup Puppet to configure your network servers"></a>Growing companies at some point are faced with the increased workload to setup, configure and maintain their servers and applications. Administrators try to script repetitive tasks and ultimately look for solutions that are scalable and provide a central management tool &#8230;<p class="read-more"><a href="http://www.itecsoftware.com/setup-puppet-to-configure-your-servers">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.itecsoftware.com/setup-puppet-to-configure-your-servers" title="Setup Puppet to configure your network servers"></a><!-- google_ad_section_start --><p>Growing companies at some point are faced with the increased workload to setup, configure and maintain their servers and applications. Administrators try to script repetitive tasks and ultimately look for solutions that are scalable and provide a central management tool base. There are several software packages available, commercial and open source ones.</p>
<p>Puppet is probably the most used open source configuration management package available today and more system administrators and software developers are interested in setting it up within their environment. An excellent book about Puppet (<a href="http://www.amazon.com/gp/product/1590599780?ie=UTF8&amp;tag=cudandsnu-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1590599780">Pulling Strings with Puppet</a>) is available and so are numerous online articles and tutorials. However, lots of online resources are just not quite complete and can lead to lots of frustration, especially in the setup and configuration of Puppet.</p>
<p>So here is another step by step tutorial about how to install and setup Puppet to the point where we can run a simple recipe residing on the server (puppetmaster) and execute on the client. For this illustration we&#8217;ll install Puppet on Ubuntu 10.10 using a deb package.</p>
<h4>Configure Network and DNS</h4>
<p>Setting up configure hostnames on server and client is crucial. Since Puppet uses self signed certificates to secure communication, it&#8217;s essential that network is setup properly and hostnames are configured with fully qualified domain names.</p>
<p>Let&#8217;s open /etc/hosts and add the necessary entries. (note: If you use a DNS server in your network, those setting changes should be made on your DNS server and not the hosts file)</p>
<pre><span id="more-574"></span>server hosts file (assuming server = 192.168.1.10, client = 192.168.1.20):</pre>
<pre>127.0.0.1 localhost.localdomain localhost puppet
192.168.1.10 puppet-server01.example.com puppet-server01 puppet
192.168.1.20 puppet-client01.example.com puppet-client01</pre>
<p>verify:</p>
<pre><span style="color: #008000;"># hostname =&gt; puppet-server01</span>
<span style="color: #008000;"># hostname -f =&gt; puppet-server01.example.com</span></pre>
<pre>client hosts file:</pre>
<pre>127.0.0.1 puppet-client01.example.com localhost
192.168.1.10 puppet-server01.example.com puppet-server01 puppet</pre>
<p>verify:</p>
<pre><span style="color: #008000;"># hostname =&gt; puppet-client01
# hostname -f =&gt; puppet-client01.example.com</span></pre>
<p>In addition, you should ensure that no firewall is blocking port 8140, as Puppet is communicating on this port.</p>
<h4>Now we&#8217;re ready to move on to <a href="http://www.itecsoftware.com/linux/install-and-configure-puppet-server-puppetmaster-on-ubuntu-10-10">installing the puppet server</a>.</h4>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.itecsoftware.com/setup-puppet-to-configure-your-servers/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install and configure puppet server (puppetmaster) on Ubuntu 10.10</title>
		<link>http://www.itecsoftware.com/install-and-configure-puppet-server-puppetmaster-on-ubuntu-10-10?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=install-and-configure-puppet-server-puppetmaster-on-ubuntu-10-10</link>
		<comments>http://www.itecsoftware.com/install-and-configure-puppet-server-puppetmaster-on-ubuntu-10-10#comments</comments>
		<pubDate>Mon, 01 Nov 2010 22:28:37 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[puppet server]]></category>
		<category><![CDATA[puppetmaster]]></category>

		<guid isPermaLink="false">http://articles.itecsoftware.com/?p=577</guid>
		<description><![CDATA[<a href="http://www.itecsoftware.com/install-and-configure-puppet-server-puppetmaster-on-ubuntu-10-10" title="Install and configure puppet server (puppetmaster) on Ubuntu 10.10"></a>Before installing and configuring puppet server (puppetmaster), ensure that your network is properly setup. Configure Puppet Server on Ubuntu 10.10 is easy and straight forward. It&#8217;s those subleties about the network configuration and necessary puppet recipes and files that can make our &#8230;<p class="read-more"><a href="http://www.itecsoftware.com/install-and-configure-puppet-server-puppetmaster-on-ubuntu-10-10">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.itecsoftware.com/install-and-configure-puppet-server-puppetmaster-on-ubuntu-10-10" title="Install and configure puppet server (puppetmaster) on Ubuntu 10.10"></a><!-- google_ad_section_start --><p>Before installing and configuring puppet server (puppetmaster), ensure that your network is properly setup. Configure Puppet Server on Ubuntu 10.10 is easy and straight forward. It&#8217;s those subleties about the network configuration and necessary puppet recipes and files that can make our lives miserable.</p>
<h4>To install Puppet, choose one of the following methods (we will use the Ubuntu Package)</h4>
<p>Using package manager of your distro</p>
<ul>
<li>RPM (Fedora) for Red Hat, Fedora (puppet-server for server, puppet for client)</li>
<li>DEB (Debian) for Ubuntu, Debian (puppetmaster for server, puppet for client)</li>
</ul>
<p>Installing from source: (note: you will need to have Ruby installed on your system prior to installing Puppet)</p>
<ul>
<li>download the latest version from <a href="http://projects.puppetlabs.com/projects/puppet/wiki/Downloading_Puppet" target="_blank">puppetlabs</a></li>
<li># tar -zxf puppet-0.xx.x.tgz</li>
<li># cd puppet-0.xx.x</li>
<li># ruby install.rb</li>
<li># puppet &#8211;version (to verify installation)</li>
</ul>
<p>Using Ruby Gem: (note: you will need to have Ruby and Ruby Gem installed on your system prior to installing Puppet)</p>
<p># gem install &#8211;remote &#8211;source http://reductivelabs.com/downloads puppet</p>
<p><span id="more-577"></span>Create a puppet user and group, in case your intallation method did not automatically create them for you:</p>
<ul>
<li><span style="color: #008000;"># groupadd puppet</span></li>
<li><span style="color: #008000;"># useradd –M –g puppet puppet</span></li>
</ul>
<p>Create a manifest. Without manifest (a text document that defines a particular configuration), puppetmaster will trow an error:</p>
<ul>
<li><span style="color: #008000;"># mkdir –p /etc/puppet/manifests</span></li>
<li><span style="color: #008000;"># mkdir –p /etc/puppet/files</span></li>
<li><span style="color: #008000;"># vi /etc/puppet/manifests/site.pp</span> (and add the following puppet class)</li>
</ul>
<p style="padding-left: 60px;">package {<br />
&#8216;htop&#8217; :<br />
ensure =&gt; installed<br />
}</p>
<p>Start the server (we start it manually to ensure it works without errors, later we will start it as a daemon)</p>
<p><span style="color: #008000;"># puppetmasterd &#8211;verbose &#8211;no-daemonize</span></p>
<p><span style="color: #000000;">We should get confirmation that the server has started and displays the current version. Any error messages should get resolved at this point before moving on to<a href="http://www.itecsoftware.com/linux/install-and-configure-puppet-client-on-ubuntu-10-10"> Install and configure puppet client on Ubuntu 10.10</a>.</span></p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.itecsoftware.com/install-and-configure-puppet-server-puppetmaster-on-ubuntu-10-10/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create Patch Files Using Patch And Diff</title>
		<link>http://www.itecsoftware.com/create-patch-files-using-patch-and-diff?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=create-patch-files-using-patch-and-diff</link>
		<comments>http://www.itecsoftware.com/create-patch-files-using-patch-and-diff#comments</comments>
		<pubDate>Wed, 04 Aug 2010 20:00:34 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[diff]]></category>
		<category><![CDATA[patch]]></category>

		<guid isPermaLink="false">http://articles.itecsoftware.com/?p=484</guid>
		<description><![CDATA[<a href="http://www.itecsoftware.com/create-patch-files-using-patch-and-diff" title="Create Patch Files Using Patch And Diff"></a>Using diff to create batch files and subsequently running them against select files is such a convenient way to update, fix or change existing files, but many developers and system administrators simply don&#8217;t know much about them. Here is a &#8230;<p class="read-more"><a href="http://www.itecsoftware.com/create-patch-files-using-patch-and-diff">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.itecsoftware.com/create-patch-files-using-patch-and-diff" title="Create Patch Files Using Patch And Diff"></a><!-- google_ad_section_start --><p>Using diff to create batch files and subsequently running them against select files is such a convenient way to update, fix or change existing files, but many developers and system administrators simply don&#8217;t know much about them.</p>
<p>Here is a quick primer on using diff and apply changes for select files. Use <span style="color: #008000;">diff &#8211;help</span> to check out more options and flags.</p>
<p>NOTE: pay caution when using patching, any mistake or error are executed without warning or undo feature. It&#8217;s best to always make a backup of any file or folder that are going to be affected by your patch.</p>
<h2>diff</h2>
<p>Some useful flags you can specify when comparing files are <strong>-b</strong> (ignore white space difference), <strong>-B</strong> (ignore blanc lines), <strong>-r</strong> (recursive) and <strong>-i</strong> (ignore case).</p>
<p>Let&#8217;s say we need to change the GA analytics code on our pages and that they are unfortunately hard coded. The files are shown below as are the results from diff:<span id="more-484"></span></p>
<p>File GA_v1:</p>
<p><span style="color: #993300;"> var _gaq = _gaq || [];<br />
_gaq.push(['_setAccount', 'UA-9876543-21']);<br />
_gaq.push(['_setDomainName', '.domain.com']);<br />
_gaq.push(['_trackPageview']);</span></p>
<p><span style="color: #993300;">(function() {<br />
var ga = document.createElement(&#8216;script&#8217;); ga.type = &#8216;text/javascript&#8217;; ga.async = true;<br />
ga.src = (&#8216;https:&#8217; == document.location.protocol ? &#8216;https://ssl  &#8216; : &#8216;http://www&#8217;) + &#8216;.google-analytics.com/ga.js&#8217;;<br />
var s = document.getElementsByTagName(&#8216;script&#8217;)[0]; s.parentNode.insertBefore(ga, s);<br />
})();</span></p>
<p>File GA_v2:</p>
<p><span style="color: #993300;"> var _gaq = _gaq || [];<br />
_gaq.push(['_setAccount', 'UA-1234567-89']);<br />
_gaq.push(['_trackPageview']);</span></p>
<p><span style="color: #993300;"> (function() {<br />
var ga = document.createElement(&#8216;script&#8217;); ga.type = &#8216;text/javascript&#8217;; ga.async = true;<br />
ga.src = (&#8216;https:&#8217; == document.location.protocol ? &#8216;https://ssl&#8217; : &#8216;http://www&#8217;) + &#8216;.google-analytics.com/ga.js&#8217;;<br />
var s = document.getElementsByTagName(&#8216;script&#8217;)[0]; s.parentNode.insertBefore(ga, s);<br />
})();</span></p>
<p>File GAold.patch, resulting from running <span style="color: #008000;">diff -bi GA_v1 GA_v2 &gt; GA_v2.patch</span>:</p>
<p><span style="color: #993300;">2c2,3<br />
&lt;   _gaq.push(['_setAccount', 'UA-1234567-89']);<br />
&#8212;<br />
&gt;   _gaq.push(['_setAccount', 'UA-9876543-21']);<br />
&gt;   _gaq.push(['_setDomainName', '.domain.com']);<br />
7c8<br />
&lt;     ga.src = (&#8216;https:&#8217; == document.location.protocol ? &#8216;https://ssl&#8217; : &#8216;http://www&#8217;) + &#8216;.google-analytics.com/ga.js&#8217;;<br />
&#8212;<br />
&gt;     ga.src = (&#8216;https:&#8217; == document.location.protocol ? &#8216;https://ssl &lt;https://ssl/&gt; &#8216; : &#8216;http://www&#8217;) + &#8216;.google-analytics.com/ga.js&#8217;;<br />
</span></p>
<p>&#8220;2c2,3&#8243; = copy line 2 (from GA_v1) to line 2 (of GA_v2), insert line 3<br />
&#8220;7c8&#8243; = copy line 7 to line 8</p>
<p>(c &#8211; copy, d &#8211; delete, a &#8211; add)</p>
<h2>patch</h2>
<p>And with this file available, we now can use patch to perform the changes. One really important flag is -<strong>-dry-run</strong> It does not actually change any files, just print what would happen. And <strong>-b</strong> will make a backup of your files. Please use it especially if you&#8217;re new to patching.</p>
<p><span style="color: #008000;">patch &#8211;dry-run GA_v1 &lt; GA_v2.patch</span></p>
<p>If you get no errors, you&#8217;re good to go.</p>
<p><span style="color: #008000;">patch -b GA_v1 &lt; GA_v2.patch</span> (using -b to make a backup)</p>
<p>Doing a diff of GA_v1 and GA_v2 shows a difference of 1 empty line. We could have avoided that using the -B flag when creating the patch file using diff, but there are many more options for both, diff and patch commands and we encourage you to explore them.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.itecsoftware.com/create-patch-files-using-patch-and-diff/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Track And Parse Twitter Messages Stream</title>
		<link>http://www.itecsoftware.com/track-and-parse-twitter-messages-stream?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=track-and-parse-twitter-messages-stream</link>
		<comments>http://www.itecsoftware.com/track-and-parse-twitter-messages-stream#comments</comments>
		<pubDate>Mon, 29 Mar 2010 18:37:57 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[parse twitter feed]]></category>
		<category><![CDATA[tweet]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://articles.itecsoftware.com/?p=362</guid>
		<description><![CDATA[<a href="http://www.itecsoftware.com/track-and-parse-twitter-messages-stream" title="Track And Parse Twitter Messages Stream"></a>Ever wanted to listen, track and parse tweets from a Twitter stream from an individual user? It&#8217;s quite an easy task, if you know the right URL&#8217;s to parse. Curl is a great little tool to get sources from almost &#8230;<p class="read-more"><a href="http://www.itecsoftware.com/track-and-parse-twitter-messages-stream">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.itecsoftware.com/track-and-parse-twitter-messages-stream" title="Track And Parse Twitter Messages Stream"></a><!-- google_ad_section_start --><p>Ever wanted to listen, track and parse tweets from a Twitter stream from an individual user? It&#8217;s quite an easy task, if you know the right URL&#8217;s to parse. Curl is a great little tool to get sources from almost any web resource and Curl has roots in Linux command like and PHP, just to name a couple.</p>
<p>Let&#8217;s look at how this would work by pulling CNN&#8217;s breaking news feed as JSON:</p>
<p><span style="color: #008000;">curl http://twitter.com/status/user_timeline/cnnbrk.json</span></p>
<p>or XML:</p>
<p><span style="color: #008000;">curl http://twitter.com/status/user_timeline/cnnbrk.xml</span></p>
<p>That will give you the last 20 tweets in either JSON or XML format.</p>
<p>An even more interesting option is to get messages where you have been mentioned. It&#8217;s a bit more complicated, as we need to supply login credentials, but no rocket science either:</p>
<p><span style="color: #008000;">curl -u &#8220;username:password&#8221; http://www.twitter.com/statuses/mentions.json</span> (or .xml if you prefer)</p>
<p>That&#8217;ll give you the last few tweets mentioning the user supplied with the curl command. Now all you got to figure out is how to parse the messages and plug them into your application.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.itecsoftware.com/track-and-parse-twitter-messages-stream/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu run script at startup, shutdown or reboot</title>
		<link>http://www.itecsoftware.com/ubuntu-run-script-at-startup-shutdown-or-reboot?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ubuntu-run-script-at-startup-shutdown-or-reboot</link>
		<comments>http://www.itecsoftware.com/ubuntu-run-script-at-startup-shutdown-or-reboot#comments</comments>
		<pubDate>Wed, 05 Aug 2009 18:27:01 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[Useful Stuff]]></category>
		<category><![CDATA[runlevel]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[skeleton]]></category>

		<guid isPermaLink="false">http://articles.itecsoftware.com/?p=206</guid>
		<description><![CDATA[<a href="http://www.itecsoftware.com/ubuntu-run-script-at-startup-shutdown-or-reboot" title="Ubuntu run script at startup, shutdown or reboot"></a>What&#8217;s the proper method to run a script at startup on Ubuntu? You can use update-rc.d for start-only or stop-only scripts, following these steps: Start script called &#8220;startup_script&#8221; on startup (note the dot at the end of the line) : &#8230;<p class="read-more"><a href="http://www.itecsoftware.com/ubuntu-run-script-at-startup-shutdown-or-reboot">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.itecsoftware.com/ubuntu-run-script-at-startup-shutdown-or-reboot" title="Ubuntu run script at startup, shutdown or reboot"></a><!-- google_ad_section_start --><p>What&#8217;s the proper method to run a script at startup on Ubuntu?<br />
You can use <span style="color: #008000;"><em>update-rc.d</em></span> for start-only or stop-only scripts, following these steps:</p>
<p>Start script called &#8220;startup_script&#8221; on startup (note the dot at the end of the line) :</p>
<p><span style="color: #008000;"># update-rc.d -f startup_script start 99 2 3 4 5 .</span></p>
<p>- start is the argument given to the command (start, stop).<br />
- 99 is the start priority of the script (1 = first one, 99= last one)<br />
- 2 3 4 5 are the runlevels at which to run the script</p>
<p>The dot at the end of the line has significance, read more here: /etc/rcS.d/README</p>
<p>Start startup_script on shutdown and reboot :<br />
<span style="color: #008000;"># update-rc.d -f startup_script start 90 0 6 .</span></p>
<p>Stop startup_script on halt and reboot :<br />
<span style="color: #008000;"># update-rc.d -f startup_script reboot 90 0 6 .</span></p>
<p>To run the script as a daemon, use the skeleton file located at &#8220;/etc/init.d/skeleton&#8221;</p>
<p>To know which runlevel you are running, type:<br />
<span style="color: #008000;">$ runlevel</span></p>
<p>Read more about runlevels <a title="Info about runlevels" href="http://en.wikipedia.org/wiki/Runlevel" target="_blank">here</a>.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.itecsoftware.com/ubuntu-run-script-at-startup-shutdown-or-reboot/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx and memcached module</title>
		<link>http://www.itecsoftware.com/nginx-and-memcached-module?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nginx-and-memcached-module</link>
		<comments>http://www.itecsoftware.com/nginx-and-memcached-module#comments</comments>
		<pubDate>Fri, 17 Jul 2009 20:31:35 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[Useful Stuff]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[memcache]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://articles.itecsoftware.com/?p=148</guid>
		<description><![CDATA[With nginx memcache module, we serve more pages faster with less hardware. It's a nobrainer.<p class="read-more"><a href="http://www.itecsoftware.com/nginx-and-memcached-module">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.itecsoftware.com/nginx-and-memcached-module" title="Nginx and memcached module"></a><!-- google_ad_section_start --><p><a rel="nofollow" href="http://www.danga.com/memcached/" target="_blank">Memcache</a> is traditionally used as a module inside server side scripts, such as <a rel="nofollow" href="http://www.php.net" target="_blank">PHP</a>, ASP, ColdFusion and others. And it&#8217;s doing a terrific job, as long as it&#8217;s implemented correctly.</p>
<p>But if we look under the hood of the actual <a rel="nofollow" href="http://www.danga.com/memcached/" target="_blank">Memcache</a> application, and I&#8217;m not talking about the PHP or ASP extension, but rather the executable that&#8217;s running as a daemon under linux, for example, it is a rather simple database like application running in memory. Now there are two basic actions that need to be performed to use it, one is writing info into memcache, the other is reading it. In a typical scenario, there are many reads for one write, that&#8217;s the whole point, isn&#8217;t it. But what if we can isolate the reading from the server side scripts, and let a small high speed module do that for us.</p>
<p><span id="more-148"></span></p>
<p>That&#8217;s where <a rel="nofollow" href="http://nginx.net/" target="_blank">Nginx</a> and it&#8217;s <a rel="nofollow" href="http://wiki.nginx.org/NginxHttpMemcachedModule" target="_blank">Memcache Module</a> comes in. We use PHP to fill up the cache and then let Nginx serve that content to the requesting client. According to lead architect Peter Gilg, this configuration is used at <a rel="nofollow" href="http://www.mademan.com/" target="_blank">Mademan.com</a>, a lifestyle site serving up to 1 million pageviews/day.</p>
<p>To be more specific, we&#8217;ll have nginx listen on port 80. If a request comes in, it checks memcache if the requested page is in memory and serves it directly to the client, or sends it to <a rel="nofollow" href="http://apache.org/" target="_blank">Apache</a> (on port 88 for example) to produce the page. At the same time apache inserts the page into memcache, so it&#8217;s available to nginx for the next request.  A sample configuration nginx script would look something like this:</p>
<pre class="code"><a href="http://wiki.nginx.org/NginxHttpCoreModule#server"><span class="kw3">server</span></a> <span class="br0">{</span>
  <a rel="nofollow" href="http://wiki.nginx.org/NginxHttpCoreModule#location"><span class="kw3">location</span></a> / <span class="br0">{</span>
    <a rel="nofollow" href="http://wiki.nginx.org/NginxHttpRewriteModule#set"><span class="kw22">set</span></a> <span class="re0">$memcached_key</span> <span class="re0">$uri</span>;
    <a rel="nofollow" href="http://wiki.nginx.org/NginxHttpMemcachedModule#memcached_pass"><span class="kw20">memcached_pass</span></a>     name:<span class="nu0">11211</span>;
    <a rel="nofollow" href="http://wiki.nginx.org/NginxHttpCoreModule#default_type"><span class="kw3">default_type</span></a>       text/html;
    <a rel="nofollow" href="http://wiki.nginx.org/NginxHttpCoreModule#error_page"><span class="kw3">error_page</span></a>         <span class="nu0">404</span> = /fallback;
  <span class="br0">}</span>

  <a rel="nofollow" href="http://wiki.nginx.org/NginxHttpCoreModule#location"><span class="kw3">location</span></a> = /fallback <span class="br0">{</span>
    <a rel="nofollow" href="http://wiki.nginx.org/NginxHttpProxyModule#proxy_pass"><span class="kw21">proxy_pass</span></a> backend;
  <span class="br0">}</span>
<span class="br0">}</span></pre>
<p><span style="text-decoration: underline;"><strong>Additional Resources:</strong></span> <a rel="nofollow" href="http://nginx.net/" target="_blank">Nginx</a> <a rel="nofollow" href="http://www.danga.com/memcached/" target="_blank">Memcache</a> <a rel="nofollow" href="http://apache.org/" target="_blank">Apache</a><script type="text/javascript"><!--
google_ad_client = "pub-5075229468189091";
google_ad_slot = "2446713154";
google_ad_width = 468;
google_ad_height = 15;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.itecsoftware.com/nginx-and-memcached-module/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Auto Create Thumnails The Easy Way</title>
		<link>http://www.itecsoftware.com/auto-create-thumnails-the-easy-way?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=auto-create-thumnails-the-easy-way</link>
		<comments>http://www.itecsoftware.com/auto-create-thumnails-the-easy-way#comments</comments>
		<pubDate>Sun, 12 Jul 2009 18:43:23 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[create tumbnails]]></category>
		<category><![CDATA[imagemagick]]></category>

		<guid isPermaLink="false">http://articles.itecsoftware.com/?p=175</guid>
		<description><![CDATA[<a href="http://www.itecsoftware.com/auto-create-thumnails-the-easy-way" title="Auto Create Thumnails The Easy Way"></a>Ever wondered it there is an easy way to resize your images or quickly create thumbnails from your favorite pictures? Search no more, the awesome little utility ImageMagick does it for you. Install it using your package manager, most of &#8230;<p class="read-more"><a href="http://www.itecsoftware.com/auto-create-thumnails-the-easy-way">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.itecsoftware.com/auto-create-thumnails-the-easy-way" title="Auto Create Thumnails The Easy Way"></a><!-- google_ad_section_start --><p>Ever wondered it there is an easy way to resize your images or quickly create thumbnails from your favorite pictures?<br />
Search no more, the awesome little utility ImageMagick does it for you.</p>
<p>Install it using your package manager, most of them should have it in their repository.</p>
<p style="padding-left: 30px;color: #008000;">sudo apt-get install imagemagick</p>
<p>Once installed, this command will create tumbnails for all JPG&#8217;s in the current directory, 200 pixel wide/high on the longest side. Eg. if your image is in landscape layout, it&#8217;ll be 200 pixel wide, in portrait format it&#8217;ll be 200 pixel high.</p>
<p style="padding-left: 30px;color: #008000;">for file in *.jpg ; do convert -resize 200 &#8220;$file&#8221; t&#8221;$file&#8221;; done</p>
<p>That&#8217;s it. Simply change 200 to the size of your liking, or change the extension if your images are in gif, png or any other image format.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.itecsoftware.com/auto-create-thumnails-the-easy-way/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 23/25 queries in 0.006 seconds using memcached
Object Caching 1221/1221 objects using memcached

Served from: www.itecsoftware.com @ 2012-02-06 06:44:08 -->
