<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>Daniel Lange's blog (Entries tagged as bash)</title>
    <link>http://daniel-lange.com/</link>
    <description>agrep -pB IT /dev/life</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.7 - http://www.s9y.org/</generator>
    <pubDate>Sat, 07 Apr 2012 06:07:35 GMT</pubDate>

    <image>
        <url>http://daniel-lange.com/templates/bulletproof/img/s9y_banner_small.png</url>
        <title>RSS: Daniel Lange's blog - agrep -pB IT /dev/life</title>
        <link>http://daniel-lange.com/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Keeping IRC nicks active</title>
    <link>http://daniel-lange.com/archives/54-Keeping-IRC-nicks-active.html</link>
            <category>IRC</category>
    
    <comments>http://daniel-lange.com/archives/54-Keeping-IRC-nicks-active.html#comments</comments>
    <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=54</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=54</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;Typical IRC services usually allow you to register with nickserv and link a number of nicks to a personal account. It&#039;s quite common to have nick, nick_ and nick__ as many IRC clients auto-append underscores if the primary nickname is already in use when connecting. Obviously you can set these alternate nicknames to almost anything you like in a decent client.&lt;/p&gt;

&lt;p&gt;Some folks also group a &quot;vanity&quot; nickname or two for whatever reason. To keep these active, people do the &quot;nick shuffle&quot; (/nick newnick, /nick oldnick) all the time:&lt;/p&gt;

&lt;p&gt;&lt;!-- s9ymdb:530 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;967&quot; height=&quot;79&quot; src=&quot;http://daniel-lange.com/uploads/entries/100309_freenode_nick_shuffle.png&quot;  alt=&quot;nick shuffle on freenode&quot; /&gt;&lt;/p&gt;

&lt;p&gt;People who forget the occasional nick shuffle may end up losing a grouped nick because it became inactive. While freenode staff try to contact people before dropping linked nicks, there are occasional prunes of &quot;old data&quot; from the services database. And then nobody can really ask upfront.&lt;/p&gt;

&lt;p&gt;So before the next big purge comes up, I wrote a small bash script that logs into a nickserv account and cycles through the linked nicks.
A few friends and me have used it successfully for many months now.&lt;/p&gt;

&lt;p&gt;Grab a copy of &lt;a href=&quot;http://daniel-lange.com/software/keepnick&quot; title=&quot;keepnick bash script&quot;&gt;keepnick (2.4kB)&lt;/a&gt; and drop it into /usr/local/bin.&lt;/p&gt;

&lt;p&gt;Keepnick expects to have an accountname, the corresponding password and then a sequence of linked nicks given on its command line.&lt;/p&gt;

&lt;p&gt;Something like&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;local&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;bin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;keepnick accountname passw0rd linked_nick linked_nick_ vanity_nick MyOtherNick&lt;/div&gt;

&lt;p&gt;should work.&lt;/p&gt;

&lt;p&gt;For regular use, you need to set up a cron job to call keepnick e.g. every week. So put something like the following script into &lt;code&gt;/etc/cron.weekly/keepnicks_irc&lt;/code&gt; or create a corresponding crontab entry for &lt;code&gt;keepnicks_irc&lt;/code&gt; if you do not have the convenient cron.* directories set up:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;#!/bin/bash&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# run keepnick for user(s) irc account(s)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# intended to be run from cron, e.g. through /etc/cron.weekly&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #007800;&quot;&gt;KEEPNICK&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/usr/local/bin/keepnick&amp;quot;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# better safe than sorry&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #007800;&quot;&gt;PATH&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin&amp;quot;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;export&lt;/span&gt; PATH&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$KEEPNICK&lt;/span&gt; accountname1 passw0rd1 linked_nick1 linked_nick1_ linked_nick1__&lt;br /&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$KEEPNICK&lt;/span&gt; accountname2 passw0rd2 linked_nick1 linked_nick2_ linked_nick2__&lt;br /&gt;&amp;#160;&lt;/div&gt;

&lt;p&gt;You should see keepnick in action now every week like this:&lt;/p&gt;

&lt;p&gt;&lt;!-- s9ymdb:529 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;758&quot; height=&quot;68&quot;  src=&quot;http://daniel-lange.com/uploads/entries/100306_keepnick_in_action.png&quot;  alt=&quot;keepnick in action&quot; /&gt;&lt;/p&gt;

&lt;p&gt;What happens here is that the IRC services package tells you, keepnick has just authenticated to your account and will now shuffle through all nicks you asked it to.
The big advantage is that is does this outside of channels, so not annoying any users. The cron job should make sure you don&#039;t forget the nick shuffle anymore.&lt;/p&gt;

&lt;h2&gt;Making sure your bash supports network connections&lt;/h2&gt;

&lt;p&gt;Stock bash will support network connections but on Debian and old (=pre-karmic) Ubuntu that capability was disabled at compile time.&lt;/p&gt;

&lt;p&gt;If you need to check whether your bash is compiled with network support, type &lt;code&gt;cat &amp;lt; /dev/tcp/time.nist.gov/13&lt;/code&gt; into a bash terminal.&lt;/p&gt;

&lt;p&gt;In case that gives you a &lt;a href=&quot;http://www.nist.gov/physlab/div847/grp40/its.cfm&quot; title=&quot;NIST Internet time service&quot;&gt;RFC-867 time string&lt;/a&gt;, you&#039;re all fine.
If not, re-compile your bash with &lt;code&gt;--enable-net-redirections&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now for something more advanced (but entirely optional):&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://daniel-lange.com/archives/54-Keeping-IRC-nicks-active.html#extended&quot;&gt;Continue reading &quot;Keeping IRC nicks active&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Tue, 18 May 2010 23:50:00 +0200</pubDate>
    <guid isPermaLink="false">http://daniel-lange.com/archives/54-guid.html</guid>
    <category>account</category>
<category>active</category>
<category>bash</category>
<category>cron</category>
<category>freenode</category>
<category>irc</category>
<category>network</category>
<category>nick</category>
<category>script</category>
<category>updated</category>

</item>
<item>
    <title>zip2dir (expand a zip to a directory of the same name)</title>
    <link>http://daniel-lange.com/archives/47-zip2dir-expand-a-zip-to-a-directory-of-the-same-name.html</link>
            <category>IT</category>
    
    <comments>http://daniel-lange.com/archives/47-zip2dir-expand-a-zip-to-a-directory-of-the-same-name.html#comments</comments>
    <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=47</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=47</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;I needed to expand a lot of jars (Java zips) and other zips of various names into directories of the same name for each file.
With 6,239 files of which some are jars, some other zips and many xml and other filetypes all not properly identified by a file extension, this gets a bit too much to do manually.&lt;/p&gt;

&lt;p&gt;So:&lt;br /&gt;
Finding candidates for these is easy with &lt;code&gt;find . -type f&lt;/code&gt;.&lt;br /&gt;
The file is most probably a zip archive if the first two characters are &quot;PK&quot;, good old &lt;a href=&quot;http://en.wikipedia.org/wiki/Phil_Katz&quot; title=&quot;Wikipedia: Phil Katz - the inventor of .zip&quot; target=&quot;_blank&quot;&gt;Phil Katz&#039;&lt;/a&gt; signature. A friendly &lt;code&gt;head -c 2&lt;/code&gt; checks that.&lt;br /&gt;
All combined with some rudimentary error checking:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;#!/bin/bash&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# There is little data security here, so know what you&#039;re doing.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# All risks in using this code are yours. It moves and deletes files quite stupidly.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# (c) Daniel Lange, 2009, v0.01, released into the public domain&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$#&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-ne&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Error: $0 expects exactly one argument, a (fully qualified) path/to/a/zipfile&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;!&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-r&lt;/span&gt; $&lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Error: file does not exist or no read permission on $1&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;2&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;!&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-w&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #007800;&quot;&gt;$(dirname $1)&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Error: cannot write to directory of $1&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #007800;&quot;&gt;$(head -c 2 $1)&lt;/span&gt;&amp;quot;&lt;/span&gt; == &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;PK&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mv&lt;/span&gt; $&lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; $1.tmp&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-p&lt;/span&gt; $&lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;unzip&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-d&lt;/span&gt; $&lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; $1.tmp&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;rm&lt;/span&gt; $1.tmp&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;$1 is not a zipfile&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;

&lt;p&gt;Download available &lt;a href=&quot;http://daniel-lange.com/software/zip2dir&quot; title=&quot;zip2dir download&quot;&gt;here (1KB)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Typical usage:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&amp;#160;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;find&lt;/span&gt; . &lt;span style=&quot;color: #660033;&quot;&gt;-type&lt;/span&gt; f &lt;span style=&quot;color: #660033;&quot;&gt;-print0&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;xargs&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--null&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-n&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; zip2dir&lt;/div&gt;

&lt;p&gt;This will expand all zips under the current directory.&lt;br /&gt;
Leave the &lt;code&gt;zip2dir&lt;/code&gt; out for a dry run (xargs will just print to the tty then). Look at the &lt;code&gt;-exec&lt;/code&gt; switch when digging around a bit more into what &lt;code&gt;find&lt;/code&gt; can do for you.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Thu, 30 Jul 2009 23:51:40 +0200</pubDate>
    <guid isPermaLink="false">http://daniel-lange.com/archives/47-guid.html</guid>
    <category>bash</category>
<category>decompress</category>
<category>directory</category>
<category>expand</category>
<category>script</category>
<category>unzip</category>
<category>zip</category>

</item>
<item>
    <title>Cool, command-line style blog design</title>
    <link>http://daniel-lange.com/archives/40-Cool,-command-line-style-blog-design.html</link>
            <category>Private</category>
    
    <comments>http://daniel-lange.com/archives/40-Cool,-command-line-style-blog-design.html#comments</comments>
    <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=40</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=40</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;It&#039;s very seldom that a blog design catches my eye.&lt;/p&gt;

&lt;div class=&quot;serendipity_imageComment_right&quot; style=&quot;width: 110px&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;a class=&#039;serendipity_image_link&#039; href=&#039;http://daniel-lange.com/uploads/entries/081217_BlogDesign_PeteHindle.png&#039; onclick=&quot;F1 = window.open(&#039;/uploads/entries/081217_BlogDesign_PeteHindle.png&#039;,&#039;Zoom&#039;,&#039;height=975,width=1277,top=32,left=9,toolbar=no,menubar=no,location=no,resize=1,resizable=1,scrollbars=yes&#039;); return false;&quot;&gt;&lt;!-- s9ymdb:524 --&gt;&lt;img class=&quot;serendipity_image_right&quot; width=&quot;110&quot; height=&quot;84&quot;  src=&quot;http://daniel-lange.com/uploads/entries/081217_BlogDesign_PeteHindle.serendipityThumb.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Screenshot of Pete Hindle&#039;s blog&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Most common templates for blog systems like Wordpress or Serendipity are very well honed. Usability, accessibility and visual design of these systems and their default templates are are as good as it gets for the time being. Trying to do better usually fails. But &lt;a href=&quot;http://code.google.com/p/wordpress-cli/&quot; title=&quot;Wordpress CLI Homepage at Google code&quot; target=&quot;_blank&quot;&gt;Wordpress-CLI&lt;/a&gt;, which I found at &lt;a href=&quot;http://www.petehindle.com/&quot; title=&quot;Pete Hindle&#039;s blog&quot; target=&quot;_blank&quot;&gt;Pete Hindle&#039;s blog&lt;/a&gt; manages to create a unique design. It may be inspired on the google shell (&lt;a href=&quot;http://goosh.org/&quot; title=&quot;Unofficial Google Shell&quot; target=&quot;_blank&quot;&gt;gosh&lt;/a&gt;) or older incarnations of the concept, e.g. &lt;a href=&quot;http://a-i-studio.com/cmd/&quot; title=&quot;WebCmd: web-based command-line interpreter (shell)&quot; target=&quot;_blank&quot;&gt;WebCmd&lt;/a&gt;, but it is unique because it requires poking and trying stuff to expose the full functionality. A bit like an old school &lt;a href=&quot;http://en.wikipedia.org/wiki/Roguelike&quot; title=&quot;Wikipedia: Rogue-like explained&quot; target=&quot;_blank&quot;&gt;rogue-like&lt;/a&gt; game, it inspires playing with it to find out more. And it reminds nicely of command interfaces to &lt;a href=&quot;http://en.wikipedia.org/wiki/Bulletin_board_system&quot; title=&quot;Wikipedia: BBS - Bulletin Board System&quot; target=&quot;_blank&quot;&gt;BBS&lt;/a&gt; systems although the authors chose a syntax to resemble a unix based shell. You can &lt;a href=&quot;http://thrind.xamai.ca/themes/&quot; title=&quot;Rob McFarland&#039;s themes for Wordpress&quot; target=&quot;_blank&quot;&gt;try out different sub-designs&lt;/a&gt; at &lt;a href=&quot;http://thrind.xamai.ca/&quot; title=&quot;Rob McFarland - the original theme author&#039;s blog&quot; target=&quot;_blank&quot;&gt;Rob McFarland&#039;s&lt;/a&gt; site. Obviously, usability still sucks, but it&#039;s worth it! Well done.
And Pete: Please write some interesting entries in that blog now &lt;img src=&quot;http://daniel-lange.com/templates/default/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Wed, 17 Dec 2008 00:30:00 +0100</pubDate>
    <guid isPermaLink="false">http://daniel-lange.com/archives/40-guid.html</guid>
    <category>bash</category>
<category>blog</category>
<category>design</category>

</item>
<item>
    <title>httpdate - set local date and time from a web server</title>
    <link>http://daniel-lange.com/archives/37-httpdate-set-local-date-and-time-from-a-web-server.html</link>
            <category>Linux</category>
    
    <comments>http://daniel-lange.com/archives/37-httpdate-set-local-date-and-time-from-a-web-server.html#comments</comments>
    <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=37</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=37</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;While &lt;a href=&quot;http://www.ntp.org&quot; title=&quot;Network Time Protocol (NTP) home page&quot; target=&quot;_blank&quot;&gt;ntp&lt;/a&gt; may be a great protocol, I find it quite bloated and slow for the simple purpose of just setting a local date and time to a reference clock. I do not need 20ms accuracy on a notebook&#039;s clock &lt;img src=&quot;http://daniel-lange.com/templates/default/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;.
Thus I use(d) &lt;a href=&quot;http://packages.debian.org/stable/net/rdate&quot; title=&quot;Debian&#039;s rdate page in lack of a proper homepage for the tool itself&quot; target=&quot;_blank&quot;&gt;rdate&lt;/a&gt; for a decade now but the public rdate servers are slowly dying out. So I&#039;m replacing it more and more with &lt;a href=&quot;http://www.clevervest.com/htp/&quot; title=&quot;htpdate home page&quot;&gt;htpdate&lt;/a&gt; which works quite nicely. It&#039;s written in C and a perl alternative is available on the author&#039;s site. There is also a forked &lt;a href=&quot;http://www.rkeene.org/oss/htp/&quot; title=&quot;(Forked) alternative and Windows version of htpdate&quot; target=&quot;_blank&quot;&gt;windows version&lt;/a&gt; of it available.&lt;/p&gt;

&lt;p&gt;Developing a bit larger bash script (which syncs a few servers), I wondered whether I could realize the time sync part in bash as well.&lt;/p&gt;

&lt;p&gt;It&#039;s quite possible:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# open a tcp connection to www.google.com&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exec&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;&amp;gt;/&lt;/span&gt;dev&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;tcp&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;www.google.com&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;80&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# say hello HTTP-style&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-e&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;GET / HTTP/1.0&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# parse for a Date: line and with a bit of magic throw the date-string at the date command &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;LC_ALL&lt;/span&gt;=C &lt;span style=&quot;color: #007800;&quot;&gt;LANG&lt;/span&gt;=en &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;date&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--rfc-2822&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--utc&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #007800;&quot;&gt;$(head &amp;lt;&amp;amp;3 | grep -i &amp;quot;Date: &amp;quot; | sed -e s/Date\:\ //I)&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# close the tcp connection&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exec&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;&amp;amp;&lt;/span&gt;-&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;

&lt;p&gt;Simple, eh?&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://daniel-lange.com/archives/37-httpdate-set-local-date-and-time-from-a-web-server.html#extended&quot;&gt;Continue reading &quot;httpdate - set local date and time from a web server&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Wed, 22 Oct 2008 23:55:13 +0200</pubDate>
    <guid isPermaLink="false">http://daniel-lange.com/archives/37-guid.html</guid>
    <category>bash</category>
<category>htpdate</category>
<category>httpdate</category>
<category>ntp</category>
<category>rdate</category>
<category>updated</category>

</item>

</channel>
</rss>
