<?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>Chmouel&#039;s Blog &#187; Scripts</title>
	<atom:link href="http://blog.chmouel.com/category/scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.chmouel.com</link>
	<description>Random and probably boring stuff.</description>
	<lastBuildDate>Wed, 01 Feb 2012 10:28:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Upload to Rackspace Cloud Files in a shell script</title>
		<link>http://blog.chmouel.com/2010/06/09/upload-to-rackspace-cloud-files-in-a-shell-script/</link>
		<comments>http://blog.chmouel.com/2010/06/09/upload-to-rackspace-cloud-files-in-a-shell-script/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 18:56:54 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Rackspace]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://blog.chmouel.com/?p=311</guid>
		<description><![CDATA[I don&#8217;t really use much the GUI and always the command line so I don&#8217;t really use the Cloud File plugin I created for nautilus. So here is a shell script to upload to Rackspace Cloud Files and give you &#8230; <a href="http://blog.chmouel.com/2010/06/09/upload-to-rackspace-cloud-files-in-a-shell-script/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t really use much the GUI and always the command line so I don&#8217;t really use the Cloud File plugin I created for nautilus.</p>
<p>So here is a shell script to upload to Rackspace Cloud Files and give you back a shortened URL of the public URL file. Great for quick sharing&#8230; You have to install the zenity binary first..</p>
<p>[Update: this is now available here <a href="https://github.com/chmouel/upcs">https://github.com/chmouel/upcs</a>]</p>
<p><script src="http://gist.github.com/431975.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2010/06/09/upload-to-rackspace-cloud-files-in-a-shell-script/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Unit conversion from zsh</title>
		<link>http://blog.chmouel.com/2010/06/06/unit-conversion-from-zsh/</link>
		<comments>http://blog.chmouel.com/2010/06/06/unit-conversion-from-zsh/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 17:58:31 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://blog.chmouel.com/?p=308</guid>
		<description><![CDATA[Quick conversion from shell :]]></description>
			<content:encoded><![CDATA[<p>Quick conversion from shell :</p>
<p><script src="http://gist.github.com/427748.js?file=unit-conversion.sh">function kilo2pound () { printf "%.2f\n" $(( $1 * 2.20462262 )) }
function pound2kilo () { printf "%.2f\n" $(( $1 / 2.20462262 )) }
function meter2feet () { printf "%.2f\n" $(( $1 * 3.2808399 )) }
function feet2meter () { printf "%.2f feet\n" $(( $1 / 3.2808399 )) }
function kilometer2miles () { printf "%.2f miles\n" $(( $1 * 0.621371192 )) }
function miles2kilometers () { printf "%.2f km\n" $(( $1 / 0.621371192 )) }
function celsius2fareinheit () { printf "%.2f fareinheit\n" $(( ($1 * 9/5) + 32 )) }
function fareinheit2celsius () { printf "%.2f celsius\n" $(( ($1 - 32) * 5/9 )) }</p>
<p></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2010/06/06/unit-conversion-from-zsh/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>rsync like backup to Rackspace Cloud File with duplicity</title>
		<link>http://blog.chmouel.com/2009/09/02/rsync-like-backup-to-rackspace-cloud-file-with-duplicity/</link>
		<comments>http://blog.chmouel.com/2009/09/02/rsync-like-backup-to-rackspace-cloud-file-with-duplicity/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 20:09:15 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Rackspace]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://blog.chmouel.com/?p=174</guid>
		<description><![CDATA[It seems that there is no much documentation about how to do rsync like backup with duplicty so here it is : Install python-cloudfiles from here http://github.com/rackspace/python-cloudfiles Install duplicity, its available directly from Debian or alike distros (ie: ubuntu) or &#8230; <a href="http://blog.chmouel.com/2009/09/02/rsync-like-backup-to-rackspace-cloud-file-with-duplicity/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It seems that there is no much documentation about how to do rsync like backup with <a href="http://" target="_blank">duplicty</a> so here it is :</p>
<ul>
<li>Install python-cloudfiles from here <a href="http://github.com/rackspace/python-cloudfiles" target="_blank">http://github.com/rackspace/python-cloudfiles</a></li>
<li style="text-align: left;">Install duplicity, its available directly from Debian or alike distros (ie: ubuntu) or you can do that from source from the <a href="http://duplicity.nongnu.org/" target="_blank">homepage</a>.</li>
<li style="text-align: left;">Get your API Key from <a href="https://manage.rackspacecloud.com/" target="_blank">https://manage.rackspacecloud.com/</a> and use a script like this :</li>
</ul>

<div class="wp_codebox"><table><tr id="p1742"><td class="code" id="p174code2"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">UPLOAD_TO_CONTAINER</span>=<span style="color: #ff0000;">&quot;backup&quot;</span> <span style="color: #666666; font-style: italic;">#adjust it as you like</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CLOUDFILES_USERNAME</span>=Your Username
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CLOUDFILES_APIKEY</span>=API_KEY_YOU_GOT
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PASSPHRASE</span>=The Passphrase <span style="color: #000000; font-weight: bold;">for</span> your encrypted backup
&nbsp;
duplicity <span style="color: #000000; font-weight: bold;">/</span>full<span style="color: #000000; font-weight: bold;">/</span>path cf+http:<span style="color: #000000; font-weight: bold;">//</span><span style="color: #800000;">${UPLOAD_TO_CONTAINER}</span></pre></td></tr></table></div>

<p>This should take care to upload the backup files to the backup container. It does that incrementally and detect the changes to your file system to upload. There is much more option for duplicity look at the manpage for more info.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2009/09/02/rsync-like-backup-to-rackspace-cloud-file-with-duplicity/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Upload to Rackspace Cloud files from GNOME nautilus</title>
		<link>http://blog.chmouel.com/2009/09/02/upload-to-rackspace-cloud-files-from-gnome-nautilus/</link>
		<comments>http://blog.chmouel.com/2009/09/02/upload-to-rackspace-cloud-files-from-gnome-nautilus/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 16:49:30 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rackspace]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://blog.chmouel.com/?p=172</guid>
		<description><![CDATA[After seeing this script http://overhrd.com/?p=106 which allow to upload files with the file manager (finder) of MacosX to Rackspace Cloud Files, I have made a nautilus script that doe the same for us Gnome/Unix users. Available here : http://github.com/chmouel/nautilus-rackspace-cloud-file/tree/master]]></description>
			<content:encoded><![CDATA[<p>After seeing this script <a href="http://overhrd.com/?p=106">http://overhrd.com/?p=106</a> which allow to upload files with the file manager (finder) of  MacosX to Rackspace Cloud Files, I have made a nautilus script that doe the same for us Gnome/Unix users.</p>
<p>Available here :</p>
<p><a href="http://github.com/chmouel/nautilus-rackspace-cloud-file/tree/master">http://github.com/chmouel/nautilus-rackspace-cloud-file/tree/master</a></p>
<p style="text-align: center;">
<p><img class="aligncenter size-medium wp-image-190" title="Screensho uploading to Rackspace Cloud File form Nautilus" src="http://blog.chmouel.com/wp-content/uploads/2009/09/Screenshot1-300x262.png" alt="Screensho uploading to Rackspace Cloud File form Nautilus" width="300" height="262" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2009/09/02/upload-to-rackspace-cloud-files-from-gnome-nautilus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using ProxyCommand with OpenSSH and a Bastion server.</title>
		<link>http://blog.chmouel.com/2009/02/08/proxycommand-ssh-bastion-proxy/</link>
		<comments>http://blog.chmouel.com/2009/02/08/proxycommand-ssh-bastion-proxy/#comments</comments>
		<pubDate>Sun, 08 Feb 2009 12:21:38 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.chmouel.com/blog/?p=113</guid>
		<description><![CDATA[So at work we have to use a bastion host for all our connections to servers to be able to get called PCI compliant. This kind of stuff could be a pain to use when you have to use another &#8230; <a href="http://blog.chmouel.com/2009/02/08/proxycommand-ssh-bastion-proxy/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So at work we have to use a <a href="http://en.wikipedia.org/wiki/Bastion_host" target="_blank">bastion host</a> for all our connections to servers to be able to get called <a href="http://www.pcicomplianceguide.org/">PCI </a>compliant. This kind of stuff could be a pain to use when you have to use another host to do RSYNC/SCP or other stuff that need direct transfer to workstation.</p>
<p>Thankfully OpenSSH is very flexible and have multiple options to easy the pain. If you add this to your ~/.ssh/config :</p>
<blockquote><p>Host bastion<br />
Hostname <span style="color: #ff9900;"><em>IP_ADDRESS_OF_BASTION_SERVER</em></span><br />
User <span style="color: #ff9900;"><em>YOUR_USERNAME</em></span><br />
ProxyCommand none<br />
ControlMaster auto<br />
ControlPath ~/.ssh/master-%r@%h:%p</p>
<p>Host *<br />
ProxyCommand ssh -qax bastion &#8216;nc -w 600 %h %p&#8217;</p></blockquote>
<p>This will allow you to pass all SSH requests to the bastion server.</p>
<p>I have experimented with different options and this seems to be most efficient way. The ControlMaster ControlPath is to speed up the connections by not reopening a tcp socket all the time to the bastion server. This seems to cause problems with the OpenSSH version shipped with some distros (ie: Fedora) so you may want to remove it if you experience problems. For the ProxyCommand there is way to use cat like this :</p>
<blockquote><p>ProxyCommand ssh bastion &#8216;exec 3&lt;&gt;/dev/tcp/%h/22;(cat &lt;&amp;3 &amp; );cat &gt;&amp;3&#8242;</p></blockquote>
<p>but the cat processes seems to hang in memory on the bastion server so netcat seems a better option.  I heard that tcpconnect from the <a href="http://linux.about.com/cs/linux101/g/tcputils.htm" target="_blank">tcputils </a>package should make things smoother but I haven&#8217;t tried that.</p>
<p>I have other options in my SSH configuration to allow to be less verbose see <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=ssh_config">ssh_config(5)</a> manpage for detailed description of each of these options :</p>
<blockquote><p>Host *<br />
ForwardAgent yes<br />
GSSAPIAuthentication no<br />
VerifyHostKeyDNS no<br />
StrictHostKeyChecking no<br />
HashKnownHosts no<br />
TCPKeepAlive yes<br />
ServerAliveInterval 600</p></blockquote>
<p>By the way forgot to mention you would need to have SSH key exchange configured with the bastion server with a SSH agent runing (these days all distros should do that by default) to don&#8217;t have to type the password of your username on bastion server.</p>
<p>I have heard there is way to do that on Windows with putty and plink but I haven&#8217;t tried that see this post <a href="http://fixunix.com/ssh/74073-putty-proxycommand.html" target="_blank">here</a> about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2009/02/08/proxycommand-ssh-bastion-proxy/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Generating md5 encrypted password for chpasswd</title>
		<link>http://blog.chmouel.com/2007/08/17/generating-md5-encrypted-password-for-chpasswd/</link>
		<comments>http://blog.chmouel.com/2007/08/17/generating-md5-encrypted-password-for-chpasswd/#comments</comments>
		<pubDate>Fri, 17 Aug 2007 07:11:38 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[Travel]]></category>

		<guid isPermaLink="false">http://www.chmouel.com/blog/2007/08/17/generating-md5-encrypted-password-for-chpasswd/</guid>
		<description><![CDATA[If you want to generate properly encrypted password to feed to chpasswd, the most easier and proper way is to do that from command line : [code lang="bash"] echo &#34;encryptedpassword&#34;&#124;openssl passwd -1 -stdin [/code] If you want to generate in &#8230; <a href="http://blog.chmouel.com/2007/08/17/generating-md5-encrypted-password-for-chpasswd/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you want to generate properly encrypted password to feed to chpasswd, the most easier and proper way is to do that from command line :<br />
[code lang="bash"]<br />
echo &quot;encryptedpassword&quot;|openssl passwd -1 -stdin<br />
[/code]<br />
If you want to generate in pure python you can do it like that :<br />
[code lang="python"]<br />
    def md5crypt(password, salt, magic='$1$'):<br />
        import md5<br />
        m = md5.new()<br />
        m.update(password + magic + salt)</p>
<p>        # /* Then just as many characters of the MD5(pw,salt,pw) */<br />
        mixin = md5.md5(password + salt + password).digest()<br />
        for i in range(0, len(password)):<br />
            m.update(mixin[i % 16])</p>
<p>        # /* Then something really weird... */<br />
        # Also really broken, as far as I can tell.  -m<br />
        i = len(password)<br />
        while i:<br />
            if i &amp; 1:<br />
                m.update('x00')<br />
            else:<br />
                m.update(password[0])<br />
            i >>= 1</p>
<p>        final = m.digest()<br />
        # /* and now, just to make sure things don't run too fast */<br />
        for i in range(1000):<br />
            m2 = md5.md5()<br />
            if i &amp; 1:<br />
                m2.update(password)<br />
            else:<br />
                m2.update(final)<br />
            if i % 3:<br />
                m2.update(salt)<br />
            if i % 7:<br />
                m2.update(password)</p>
<p>            if i &amp; 1:<br />
                m2.update(final)<br />
            else:<br />
                m2.update(password)</p>
<p>            final = m2.digest()</p>
<p>        # This is the bit that uses to64() in the original code.<br />
        itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'<br />
        rearranged = ''<br />
        for a, b, c in ((0, 6, 12), (1, 7, 13), (2, 8, 14), (3, 9, 15), (4, 10, 5)):<br />
            v = ord(final[a]) < < 16 | ord(final[b]) << 8 | ord(final[c])<br />
            for i in range(4):<br />
                rearranged += itoa64[v &amp; 0x3f]; v >>= 6</p>
<p>        v = ord(final[11])<br />
        for i in range(2):<br />
            rearranged += itoa64[v &amp; 0x3f]; v >>= 6</p>
<p>        return magic + salt + '$' + rearranged</p>
<p>[/code]</p>
<p>You need to feed it up with a salt, like this :<br />
[code lang="python"]<br />
    def generate_salt(count):<br />
        import random, string<br />
        char = string.ascii_letters + string.digits + string.punctuation.replace(':', '')<br />
        return string.join(map(lambda x,v=char: random.choice(v), range(count)), '')<br />
[/code]</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2007/08/17/generating-md5-encrypted-password-for-chpasswd/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Automatic best resolution with xrandr</title>
		<link>http://blog.chmouel.com/2007/07/31/automatic-best-resolution-with-xrandr/</link>
		<comments>http://blog.chmouel.com/2007/07/31/automatic-best-resolution-with-xrandr/#comments</comments>
		<pubDate>Tue, 31 Jul 2007 22:23:32 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.chmouel.com/blog/2007/07/31/automatic-best-resolution-with-xrandr/</guid>
		<description><![CDATA[If you like me you have a big screen with your laptop and wants to automate when your X session start to get the best resolution, you can use that script : [code lang="bash"] #!/bin/bash function get_resolutions() { xrandr&#124;while read &#8230; <a href="http://blog.chmouel.com/2007/07/31/automatic-best-resolution-with-xrandr/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you like me you have a big screen with your laptop and wants to automate when your X session start to get the best resolution, you can use that script :</p>
<p>[code lang="bash"]<br />
#!/bin/bash</p>
<p>function get_resolutions() {<br />
xrandr|while read -a line;do<br />
RES="${line[1]}x${line[3]} "<br />
[[ ${RES} != [0-9]* ]] &amp;&amp; continue<br />
echo ${RES}<br />
done<br />
}</p>
<p>_BEST_RES=0<br />
BEST_RES=<br />
for res in $(get_resolutions);do<br />
_res=${res/x/}<br />
[[ $_res -ge ${_BEST_RES} ]] &amp;&amp; {<br />
BEST_RES=${res}<br />
_BEST_RES=${_res}<br />
}<br />
done<br />
xrandr -s ${BEST_RES}<br />
[/code]</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2007/07/31/automatic-best-resolution-with-xrandr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automate SSH known_hosts cleanup</title>
		<link>http://blog.chmouel.com/2007/05/30/automate-ssh-known_hosts-cleanup/</link>
		<comments>http://blog.chmouel.com/2007/05/30/automate-ssh-known_hosts-cleanup/#comments</comments>
		<pubDate>Wed, 30 May 2007 22:33:40 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.chmouel.com/blog/2007/05/30/automate-ssh-known_hosts-cleanup/</guid>
		<description><![CDATA[If you like me, you have to do a lot of installs[1] of the same test machine with the same IP and have to ssh it you will notice this annoying message : IT IS POSSIBLE THAT SOMEONE IS DOING &#8230; <a href="http://blog.chmouel.com/2007/05/30/automate-ssh-known_hosts-cleanup/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you like me, you have to do a lot of installs[1] of the same test machine with the same IP and have to ssh it  you will notice this annoying message :</p>
<pre>IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
54:9d:c0:37:3a:80:48:6c:82:ec:d1:84:93:61:24.
Please contact your system administrator.
Add correct host key in /home/cboudjnah/.ssh/known_hosts
to get rid of this message.
Offending key in /home/cboudjnah/.ssh/known_hosts:595
Password authentication is disabled to avoid
 man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid
man-in-the-middle attacks.
Agent forwarding is disabled to avoid man-in-the-middle attacks.</pre>
<p>I have automated the cleanup by a script :<br />
[code lang="bash"]<br />
#!/bin/bash<br />
H=$1</p>
<p>[[ -z ${H} ]] &amp;&amp; { echo "Need a host as argument"; exit 1 ;}<br />
LINE=$(ssh -o StrictHostKeyChecking=yes $1 'exit' 2>&amp;1 | sed -n '/Offending key/ { s/.*://;s/r//;p }')<br />
[[ -z ${LINE} ]] &amp;&amp; { echo "Nothing to clean";  exit; }<br />
sed -i -n "$LINE!p" ~/.ssh/known_hosts[/code]<br />
[1] Like having to tests bunch of <a href="http://www.informatik.uni-koeln.de/fai/">FAI</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2007/05/30/automate-ssh-known_hosts-cleanup/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SVN Diff against changes in the remote repository.</title>
		<link>http://blog.chmouel.com/2007/02/06/svn-diff-against-changes-in-the-remote-repository/</link>
		<comments>http://blog.chmouel.com/2007/02/06/svn-diff-against-changes-in-the-remote-repository/#comments</comments>
		<pubDate>Wed, 07 Feb 2007 03:02:26 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.chmouel.com/blog/2007/02/06/svn-diff-against-changes-in-the-remote-repository/</guid>
		<description><![CDATA[A useful svn wrapper scripts. Get a diff of your local repostitory against the upstream repository changes. I wonder why it is not builtins though like a svn status -u but for dif. #!/bin/bash &#160; IFS=&#34; &#34; for line in &#8230; <a href="http://blog.chmouel.com/2007/02/06/svn-diff-against-changes-in-the-remote-repository/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A useful svn wrapper scripts. Get a diff of your local repostitory against the upstream repository changes. I wonder why it is not builtins though like a svn status -u but for dif.</p>

<div class="wp_codebox"><table><tr id="p494"><td class="code" id="p49code4"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #007800;">IFS</span>=<span style="color: #ff0000;">&quot;
&quot;</span>
<span style="color: #000000; font-weight: bold;">for</span> line <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">svn</span> status -u<span style="color: #000000; font-weight: bold;">`</span>;<span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$line</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;   &quot;</span><span style="color: #000000; font-weight: bold;">*</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">continue</span>
    <span style="color: #007800;">rev</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$line</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span><span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #007800;">ff</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$line</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $3}'</span><span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">diff</span> <span style="color: #660033;">-r</span><span style="color: #800000;">${rev}</span>:HEAD <span style="color: #007800;">$ff</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2007/02/06/svn-diff-against-changes-in-the-remote-repository/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>History expansion and substitions in ZSH</title>
		<link>http://blog.chmouel.com/2007/01/10/history-expansion-and-substitions-in-zsh/</link>
		<comments>http://blog.chmouel.com/2007/01/10/history-expansion-and-substitions-in-zsh/#comments</comments>
		<pubDate>Thu, 11 Jan 2007 05:05:50 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.chmouel.com/blog/2007/01/10/history-expansion-and-substitions-in-zsh/</guid>
		<description><![CDATA[I better to keep that somewhere since i always forget that thing, to do a search and replace from the command line in zsh. you just have to do the :s^FOO^BAR after your expansion For example you just have typed &#8230; <a href="http://blog.chmouel.com/2007/01/10/history-expansion-and-substitions-in-zsh/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I better to keep that somewhere since i always forget that thing, to do a search and replace from the command line in zsh. you just have to do the :s^FOO^BAR after your expansion</p>
<p>For example you just have typed the long command line :</p>
<pre>
blah bar FOO=1 FOO=3 FOO=6 cnt=1
</pre>
<p>you can just type :</p>
<pre>
!blah:s^FOO^VALUE^:G
</pre>
<p>and it will be expanded to :</p>
<pre>
blah bar VALUE=1 VALUE=3 VALUE=6 cnt=1
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2007/01/10/history-expansion-and-substitions-in-zsh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

