<?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>Nicolás Brailovsky &#187; Console</title>
	<atom:link href="http://nicolasb.com.ar/category/linux/console/feed/" rel="self" type="application/rss+xml" />
	<link>http://nicolasb.com.ar</link>
	<description>A modern blog</description>
	<lastBuildDate>Thu, 02 Sep 2010 12:47:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Oh my god</title>
		<link>http://nicolasb.com.ar/2010/07/oh-my-god/</link>
		<comments>http://nicolasb.com.ar/2010/07/oh-my-god/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 10:00:40 +0000</pubDate>
		<dc:creator>nico</dc:creator>
				<category><![CDATA[Console]]></category>

		<guid isPermaLink="false">http://nicolasb.com.ar/?p=923</guid>
		<description><![CDATA[


An old good Unix console joke goes like this:
% ar m God
ar: God does not exist
Obviously thats a very old and used joke, nowdays we&#8217;re much more advanced than that:
$ ar m God
$ ar: creating God




]]></description>
			<content:encoded><![CDATA[<table width="100%">
<tbody>
<tr>
<td width="*">An old good Unix console joke goes like this:</p>
<p>% ar m God<br />
ar: God does not exist</p>
<p>Obviously thats a very old and used joke, nowdays we&#8217;re much more advanced than that:</p>
<p>$ ar m God<br />
$ ar: creating God</td>
<td width="300"><a href="http://nicolasb.com.ar/archivos/2010/04/homer-and-god.jpg"><img class="aligncenter size-full wp-image-940" title="homer-and-god" src="http://nicolasb.com.ar/archivos/2010/04/homer-and-god.jpg" alt="" width="300" height="225" /></a></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://nicolasb.com.ar/2010/07/oh-my-god/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elvis is alive!</title>
		<link>http://nicolasb.com.ar/2010/07/elvis-is-alive/</link>
		<comments>http://nicolasb.com.ar/2010/07/elvis-is-alive/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 11:42:31 +0000</pubDate>
		<dc:creator>nico</dc:creator>
				<category><![CDATA[Console]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://nicolasb.com.ar/?p=924</guid>
		<description><![CDATA[Unix trivia day: in the olden days of the 90&#8217;s there were a lot of Unix boxes out there named &#8220;elvis&#8221;. Nowdays it&#8217;s not uncommon to find one, either. Have you ever wondered why are there so many boxes called elvis?
This is related to Solaris&#8217; ping command. When you ping $HOST it prints &#8220;$HOST is [...]]]></description>
			<content:encoded><![CDATA[<p>Unix trivia day: in the olden days of the 90&#8217;s there were a lot of Unix boxes out there named &#8220;elvis&#8221;. Nowdays it&#8217;s not uncommon to find one, either. Have you ever wondered why are there so many boxes called elvis?</p>
<p>This is related to Solaris&#8217; ping command. When you ping $HOST it prints &#8220;$HOST is alive&#8221; (if it&#8217;s responding the pings), thus elvis is alive!</p>
<p><a href="http://nicolasb.com.ar/archivos/2010/04/homer-simpson-elvis1.gif"><img class="aligncenter size-medium wp-image-942" title="homer-simpson-elvis1" src="http://nicolasb.com.ar/archivos/2010/04/homer-simpson-elvis1-255x300.gif" alt="" width="255" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasb.com.ar/2010/07/elvis-is-alive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sed magic: a simple guide</title>
		<link>http://nicolasb.com.ar/2009/09/sed-magic-a-simple-guide/</link>
		<comments>http://nicolasb.com.ar/2009/09/sed-magic-a-simple-guide/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 10:00:50 +0000</pubDate>
		<dc:creator>nico</dc:creator>
				<category><![CDATA[Console]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://nicolasb.com.ar/?p=517</guid>
		<description><![CDATA[


The other day I had to create one of those &#8220;enum to string&#8221; functions. They really suck, always getting out of sync, so I made a script to auto-update the header file containing this function&#8230; just add a target to the makefile and you&#8217;re done!




Anyway, this is the part of the script I came up [...]]]></description>
			<content:encoded><![CDATA[<table border="0">
<tbody>
<tr>
<td>The other day I had to create one of those &#8220;enum to string&#8221; functions. They really suck, always getting out of sync, so I made a script to auto-update the header file containing this function&#8230; just add a target to the makefile and you&#8217;re done!</td>
<td><a href="http://nicolasb.com.ar/archivos/2009/09/11Sed.jpg"><img class="aligncenter size-medium wp-image-570" title="11Sed" src="http://nicolasb.com.ar/archivos/2009/09/11Sed-295x300.jpg" alt="11Sed" width="295" height="300" /></a></td>
</tr>
</tbody>
</table>
<p>Anyway, this is the part of the script I came up with to get the enum elements:</p>
<p><span lang="bash"><br />
cat enum_definition.h | sed -n &#8216;/enum OID/,/\}\;/ s/\(.*\)/\1/p&#8217;<br />
</span></p>
<p>Nice voodoo, isn&#8217;t it? How the hell are you supposed to understand that? Well, you&#8217;re not, sed is write-only-code, but you can try reading <a href="http://www.grymoire.com/Unix/Sed.html#toc-uh-25">http://www.grymoire.com/Unix/Sed.html#toc-uh-25</a>, a great sed introduction.</p>
<p>Have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasb.com.ar/2009/09/sed-magic-a-simple-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Console foo: Scheduling commands</title>
		<link>http://nicolasb.com.ar/2009/09/console-foo-scheduling-commands/</link>
		<comments>http://nicolasb.com.ar/2009/09/console-foo-scheduling-commands/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 10:00:35 +0000</pubDate>
		<dc:creator>nico</dc:creator>
				<category><![CDATA[Console]]></category>

		<guid isPermaLink="false">http://nicolasb.com.ar/?p=434</guid>
		<description><![CDATA[Use "at" to schedule commands, for example:
$ at today 3:30 PM
> wget foobar.com/a_huge_file
> C-D]]></description>
			<content:encoded><![CDATA[<table border="0">
<tbody>
<tr>
<td>You can easily schedule a command using &#8220;at&#8221;, which recognizes a nicely formatted date string. For example:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">$ at today <span class="nu0">3</span>:<span class="nu0">00</span> AM</div>
</li>
</ol>
</div>
<p>This will open a prompt. So, for example:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">$ at today <span class="nu0">3</span>:<span class="nu0">30</span> PM</div>
</li>
<li class="li1">
<div class="de1">&gt; <span class="kw2">wget</span> foobar.com/a_huge_file</div>
</li>
<li class="li1">
<div class="de1">&gt; C-D</div>
</li>
</ol>
</div>
<p>Will schedule a download of a huge file, today at 3:00 AM. Nice, isn&#8217;t it?<br />
To check the whole list of accepted formats check the man for at.</td>
<td><a href="http://nicolasb.com.ar/archivos/2009/06/At-at.png"><img class="aligncenter size-medium wp-image-449" title="At-at" src="http://nicolasb.com.ar/archivos/2009/06/At-at-295x300.png" alt="At-at" width="295" height="300" /></a></td>
</tr>
</tbody>
</table>
<p>One last note: at will &#8220;remember&#8221; the current environment variables, so PWD, USER, OLD_DIR and all that will be the same. This means if you schedule a command with a relative path it&#8217;ll still work!</p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasb.com.ar/2009/09/console-foo-scheduling-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mocp rand</title>
		<link>http://nicolasb.com.ar/2009/07/mocp-rand/</link>
		<comments>http://nicolasb.com.ar/2009/07/mocp-rand/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 09:00:15 +0000</pubDate>
		<dc:creator>nico</dc:creator>
				<category><![CDATA[Console]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://nicolasb.com.ar/?p=429</guid>
		<description><![CDATA[



I&#8217;m quite sure everyone reading this must have a respectable, if not massive, music collection. In this days and age is difficult finding someone who doesn&#8217;t. It&#8217;s also difficult to choose one, and only one, disk to listen at any given moment. Until we&#8217;re upgraded to support concurrent music listening we&#8217;re better of with a [...]]]></description>
			<content:encoded><![CDATA[<table border="0">
<tbody>
<tr>
<td><a href="http://nicolasb.com.ar/archivos/2009/06/music-score.jpg"><img class="aligncenter size-thumbnail wp-image-432" title="music-score" src="http://nicolasb.com.ar/archivos/2009/06/music-score-150x150.jpg" alt="music-score" width="150" height="150" /></a></td>
<td>I&#8217;m quite sure everyone reading this must have a respectable, if not massive, music collection. In this days and age is difficult finding someone who doesn&#8217;t. It&#8217;s also difficult to choose one, and only one, disk to listen at any given moment. Until we&#8217;re upgraded to support concurrent music listening we&#8217;re better of with a random disk selector, which is exactly what this little script does:</td>
</tr>
</tbody>
</table>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re3">#!/bin/bash</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="re2">SEARCH_DIR=</span><span class="st0">&#8216;/home/nico/Música&#8217;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re2">START_RANDOM=</span><span class="nu0">1</span></div>
</li>
<li class="li2">
<div class="de2"><span class="re2">RAND_MAX=</span><span class="nu0">32767</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">while</span> <span class="br0">&#40;</span><span class="br0">&#40;</span> <span class="nu0">1</span> <span class="br0">&#41;</span><span class="br0">&#41;</span>; <span class="kw1">do</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re2">NUM_DISCS=</span>$<span class="br0">&#40;</span><span class="kw2">find</span> <span class="re1">$SEARCH_DIR</span> -<span class="kw3">type</span> d|wc -l<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re2">RAND=</span>$<span class="br0">&#40;</span><span class="br0">&#40;</span><span class="re1">$NUM_DISCS</span> * <span class="re1">$RANDOM</span> / <span class="re1">$RAND_MAX</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="re2">RAND_DISC=</span>$<span class="br0">&#40;</span><span class="kw2">find</span> <span class="re1">$SEARCH_DIR</span> -<span class="kw3">type</span> d | <span class="kw2">head</span> -n <span class="re1">$RAND</span> | <span class="kw2">tail</span> -n <span class="nu0">1</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="re3"># Wake up moc</span></div>
</li>
<li class="li1">
<div class="de1">mocp -FS <span class="nu0">2</span>&gt;/dev/null &gt;/dev/null &amp;amp;</div>
</li>
<li class="li1">
<div class="de1">mocp -pca <span class="st0">&quot;$RAND_DISC&quot;</span> &amp;amp;</div>
</li>
<li class="li2">
<div class="de2"><span class="kw3">echo</span> <span class="st0">&quot;Playing $RAND_DISC&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="re3"># Start from a random <span class="kw2">file</span>?</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span> <span class="re1">$START_RANDOM</span> <span class="br0">&#41;</span><span class="br0">&#41;</span>; <span class="kw1">then</span></div>
</li>
<li class="li1">
<div class="de1">mocp &#8211;on shuffle &amp;amp;</div>
</li>
<li class="li2">
<div class="de2">mocp -f &amp;amp;</div>
</li>
<li class="li1">
<div class="de1">mocp &#8211;off shuffle &amp;amp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">fi</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">read</span></div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">done</span></div>
</li>
</ol>
</div>
<table border="0">
<tbody>
<tr>
<td>Of course, it requires <a href="http://moc.daper.net/">mocp</a>, my favorite music (on console) player. And obviously, you&#8217;ll have to configure SEARCH_DIR but I&#8217;m sure some bash hacking is not that hard.<br />
Beware though, using this + cron may have the undesired effect of awakening to the pleasant music of Cannibal Corpse.</td>
<td><a href="http://nicolasb.com.ar/archivos/2009/06/0601_ozzy_osbourne_c.jpg"><img class="aligncenter size-medium wp-image-431" title="0601_ozzy_osbourne_c" src="http://nicolasb.com.ar/archivos/2009/06/0601_ozzy_osbourne_c-300x297.jpg" alt="0601_ozzy_osbourne_c" width="180" height="178" /></a></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://nicolasb.com.ar/2009/07/mocp-rand/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
