<?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>ArvinderKang.com &#187; script</title>
	<atom:link href="http://arvinderkang.com/tag/script/feed/" rel="self" type="application/rss+xml" />
	<link>http://arvinderkang.com</link>
	<description>The world is my backyard.</description>
	<lastBuildDate>Thu, 29 Jul 2010 22:58:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>One command to rule&#8230;. alright, just return an IP</title>
		<link>http://arvinderkang.com/2009/12/08/one-command-to-rule-alright-just-return-an-ip/</link>
		<comments>http://arvinderkang.com/2009/12/08/one-command-to-rule-alright-just-return-an-ip/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 23:49:57 +0000</pubDate>
		<dc:creator>Arvinder Kang</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[ipaddress]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://arvinderkang.com/2009/12/08/one-command-to-rule-alright-just-return-an-ip/</guid>
		<description><![CDATA[One of my friends who is into networks always joke, as why there is no single Unix command to return only the IP address and nothing else. Here is a script that just does that one thing and nothing else. &#8230; <a href="http://arvinderkang.com/2009/12/08/one-command-to-rule-alright-just-return-an-ip/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of my friends who is into networks always joke, as why there is no single Unix command to return only the IP address and nothing else. Here is a script that just does that one thing and nothing else.</p>

<p><code>
    #!/usr/bin/env bash
    # Arvinder Singh Kang
    # askang@olemiss.edu
    # Version 0.1 - 2009-06-02
    # ipaddress: This snippet returns the ipaddress of the current computer. Store in a directory which is in the PATH, and make it executable by running "chmod +x ipaddress". 
    # Running command ipaddress should return ipaddresses of this machine.</p>

<pre><code>ifconfig  | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}'
</code></pre>

<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://arvinderkang.com/2009/12/08/one-command-to-rule-alright-just-return-an-ip/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Automating Drupal workflow using Git and Drush</title>
		<link>http://arvinderkang.com/2009/10/29/automating-drupal-workflow-using-git-and-drush/</link>
		<comments>http://arvinderkang.com/2009/10/29/automating-drupal-workflow-using-git-and-drush/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 23:53:16 +0000</pubDate>
		<dc:creator>Arvinder Kang</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[automate]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[drush]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://arvinderkang.com/2009/10/29/automating-drupal-workflow-using-git-and-drush/</guid>
		<description><![CDATA[Update Nov 11, 2009: Updated the script to accept username and server name as arguments and to print syntax help if no argument is passed. It would eliminate to modify script for different servers. Drupal rocks for some things, its &#8230; <a href="http://arvinderkang.com/2009/10/29/automating-drupal-workflow-using-git-and-drush/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Update Nov 11, 2009</strong>: <em>Updated the script to accept username and server name as arguments and to print syntax help if no argument is passed. It would eliminate to modify script for different servers.</em></p>

<p>Drupal rocks for some things, its deployment sucks! As I automate my drupal workflows better, I should post them one by one.</p>

<p>Following is the my bash script recipe, for installing drupal, checking it into a git repository and replicating it remotely.</p>

<p>The second piece of puzzle should be automating MySQL backup and deployment using either Capistrano or Vlad.</p>

<p><span id="more-199"></span>
<script src="http://gist.github.com/221965.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://arvinderkang.com/2009/10/29/automating-drupal-workflow-using-git-and-drush/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A simple shell trick</title>
		<link>http://arvinderkang.com/2008/08/20/a-simple-shell-trick/</link>
		<comments>http://arvinderkang.com/2008/08/20/a-simple-shell-trick/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 20:24:31 +0000</pubDate>
		<dc:creator>Arvinder Kang</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[du]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://arvinderkang.com/2008/08/20/a-simple-shell-trick/</guid>
		<description><![CDATA[Here is shell a trick that I used lately. Before moving to new system (where I enforce quotas on all home folders), I had portable home directories for all the users on my shared server storage. The old setup did &#8230; <a href="http://arvinderkang.com/2008/08/20/a-simple-shell-trick/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is shell a trick that I used lately.</p>

<p>Before moving to new system (where I enforce quotas on all home folders), I had <a href="http://www.makemacwork.com/portable-home-directories-1.htm" title="Portable Home Directories &#8212; Part 1 : Make Mac Work">portable home directories</a> for all the users on my shared server storage. The old setup did not strictly apply the quota limits on all users. Some of the users had large home folders and a couple of them logging on different systems, would fill up the whole hard disk on that system.</p>

<p>To find out how much space each user was using on the server, I ran the following command in their home directory.</p>

<pre><code>$ du -chd -1 &gt; $HOME/user_space_report.txt
</code></pre>

<p>Simple.</p>
]]></content:encoded>
			<wfw:commentRss>http://arvinderkang.com/2008/08/20/a-simple-shell-trick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jukebox in a single line</title>
		<link>http://arvinderkang.com/2008/06/28/jukebox-in-a-single-line/</link>
		<comments>http://arvinderkang.com/2008/06/28/jukebox-in-a-single-line/#comments</comments>
		<pubDate>Sun, 29 Jun 2008 04:05:34 +0000</pubDate>
		<dc:creator>Arvinder Kang</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[jukebox]]></category>
		<category><![CDATA[line]]></category>
		<category><![CDATA[mp3 player]]></category>
		<category><![CDATA[one]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[single]]></category>

		<guid isPermaLink="false">http://arvinderkang.com/2008/06/29/jukebox-in-a-single-line/</guid>
		<description><![CDATA[If you are like me, who starts starts iTunes with default library and realize you have heard the same song 8 times in the last week, here are two one-line-Jukebox scripts for you. The scripts randomly choose and play songs &#8230; <a href="http://arvinderkang.com/2008/06/28/jukebox-in-a-single-line/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you are like me, who starts starts iTunes with default library and  realize you have heard the same song 8 times in the last week, here are two one-line-Jukebox scripts for you. The scripts randomly choose and play songs right from the command line.</p>

<p>Before using the script make sure you have an mp3 player installed. <a href="http://arvinderkang.com/2008/06/28/installing-command-line-mp3-player/" title="Installing command line MP3 player | ArvinderKang.com">I have installed lightweight mpg123</a>, however you can use any player. I would recommend <a href="http://www.mplayerhq.hu/" title="Entering MPlayer homepage">mplayer</a> for Linux.</p>

<p>While running the scripts, I pass ~/Music folder argument. Change the path to point to folder where you store your mp3s.</p>

<p>First one is in <a href="http://www.ruby-lang.org/" title="Ruby Programming Language">Ruby</a>, and shamelessly inspired by <a href="http://www.amazon.com/Ruby-Example-Concepts-Kevin-Baird/dp/1593271484" title="Amazon.com: Ruby by Example: Concepts and Code: Kevin Baird: Books">Kevin Baird&#8217;s book</a>.</p>

<p>Open a text editor and save this script. I named it shuffle_play.rb. (You need to have ruby installed on your system. Installed on Leopard and most Linux distributions by default.)</p>

<pre><code>#!/usr/bin/env ruby -w
ARGV.sort_by{ rand }.each {|file| system("mpg123 \"#{file}\"")}
</code></pre>

<p>To run the jukebox</p>

<pre><code>ruby shuffle_play.rb ~/Music/*.mp3
</code></pre>

<p>For the second, I ported above  script to bash, which is even more simple and can run on any Linux or OS X. Lets name the script shuffle&#95;play&#95;shell.sh</p>

<pre><code>#!/usr/bin/env bash
n=0;for songs in "$@" ; do song_array[n]=$songs ;((n++)) ; done; for ((i=0;i&lt;$n;i+=1));do number=$RANDOM; let "number %= $n"; `mpg123 "${song_array[number]}"`; done
</code></pre>

<p>To run the jukebox</p>

<pre><code>source shuffle_play_shell.sh ~/Music/*.mp3
</code></pre>

<p><em>Update</em>: The second one is not completely random. It will choose n random songs out of n songs. However it does not checks if each song is played at-least once, thus chances of songs getting repeated. Any suggestions?</p>
]]></content:encoded>
			<wfw:commentRss>http://arvinderkang.com/2008/06/28/jukebox-in-a-single-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->