<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>Mahadeva &#187; Linux</title>
	<atom:link href="http://www.patriciomolina.com/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.patriciomolina.com</link>
	<description>Blog de Patricio Molina</description>
	<lastBuildDate>Mon, 06 Feb 2012 04:26:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/ar/</creativeCommons:license>		<item>
		<title>Got Linux?</title>
		<link>http://www.patriciomolina.com/2011/08/got-linux/</link>
		<comments>http://www.patriciomolina.com/2011/08/got-linux/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 01:53:35 +0000</pubDate>
		<dc:creator>Pato</dc:creator>
				<category><![CDATA[Fotos]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ben gurión]]></category>
		<category><![CDATA[bsod]]></category>
		<category><![CDATA[gnu/linux]]></category>
		<category><![CDATA[tlv]]></category>

		<guid isPermaLink="false">http://www.patriciomolina.com/?p=857</guid>
		<description><![CDATA[Por un capricho del azar, me encontré con un BSoD en el Aeropuerto Internacional Ben Gurión, justo cuando vestía mi viejísima remera &#8220;got linux?&#8220;. Foto © Galio]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.patriciomolina.com/wp-content/uploads/2011/08/bsod.jpg"><img class="aligncenter size-full wp-image-858" title="bsod" src="http://www.patriciomolina.com/wp-content/uploads/2011/08/bsod.jpg" alt="" width="437" height="583" /></a></p>
<p>Por un capricho del azar, me encontré con un <a href="http://es.wikipedia.org/wiki/BSoD">BSoD</a> en el <a href="http://es.wikipedia.org/wiki/Aeropuerto_Internacional_Ben_Guri%C3%B3n">Aeropuerto Internacional Ben Gurión</a>, justo cuando vestía mi <s>viejísima</s> remera &#8220;<a href="http://es.wikipedia.org/wiki/GNU/Linux">got linux?</a>&#8220;.</p>
<p>Foto © <a href="http://www.flickr.com/photos/galio/">Galio</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.patriciomolina.com/2011/08/got-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Consultando Crunchbase con Python</title>
		<link>http://www.patriciomolina.com/2009/09/consultando-crunchbase-con-python/</link>
		<comments>http://www.patriciomolina.com/2009/09/consultando-crunchbase-con-python/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 21:52:33 +0000</pubDate>
		<dc:creator>Pato</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[crunchbase]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[simplejson]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.patriciomolina.com/?p=91</guid>
		<description><![CDATA[Por mi trabajo, siempre estoy pendiente de lo que sucede en Crunchbase (de hecho, estoy suscripto a su feed de páginas recientes). Con tantas empresas y personas yendo y viniendo por Twitter, se transformó en una fuente de consulta permanente. &#8230; <a href="http://www.patriciomolina.com/2009/09/consultando-crunchbase-con-python/">Sigue leyendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Por mi trabajo, siempre estoy pendiente de lo que sucede en <a href="http://www.crunchbase.com/">Crunchbase</a> (de hecho, estoy suscripto a su <em><a href="http://es.wikipedia.org/wiki/Fuente_web">feed</a></em> de <a href="http://crunchbase.com/recently-added.rss">páginas recientes</a>). Con tantas empresas y personas yendo y viniendo por Twitter, se transformó en una fuente de consulta permanente.</p>
<p>¿Puedo consultar Crunchbase con Python? La respuesta es obvia <img src='http://www.patriciomolina.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Crunchbase tiene una <a href="http://es.wikipedia.org/wiki/Interfaz_de_programaci%C3%B3n_de_aplicaciones">API</a> muy interesante que devuelve resultados en formato <a href="http://es.wikipedia.org/wiki/JSON">JSON</a>. Pueden encontrar documentación sobre su uso en <a href="http://groups.google.com/group/crunchbase-api/">crunchbase-api</a>.</p>
<p>Para este programa estoy usando la librería <a href="http://pypi.python.org/pypi/simplejson/">simplejson</a> (<tt>sudo apt-get install python-simplejson</tt>)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>, <span style="color: #dc143c;">urllib</span>, simplejson
&nbsp;
api = <span style="color: #483d8b;">'http://api.crunchbase.com/v/1/search.js?%s'</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&gt;</span>= <span style="color: #ff4500;">2</span>:
        q = <span style="color: #483d8b;">' '</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>:<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
        source = <span style="color: #dc143c;">urllib</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span>api <span style="color: #66cc66;">%</span> <span style="color: #dc143c;">urllib</span>.<span style="color: black;">urlencode</span><span style="color: black;">&#40;</span><span style="color: black;">&#123;</span><span style="color: #483d8b;">'query'</span>: q<span style="color: black;">&#125;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
        results = simplejson.<span style="color: black;">loads</span><span style="color: black;">&#40;</span>source.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">if</span> results<span style="color: black;">&#91;</span><span style="color: #483d8b;">'results'</span><span style="color: black;">&#93;</span>:
            <span style="color: #ff7700;font-weight:bold;">for</span> r <span style="color: #ff7700;font-weight:bold;">in</span> results<span style="color: black;">&#91;</span><span style="color: #483d8b;">'results'</span><span style="color: black;">&#93;</span>:
                name = r.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'name'</span><span style="color: black;">&#41;</span>
                <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> name:
                    name = <span style="color: #483d8b;">' '</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>w.<span style="color: black;">capitalize</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> \
                        <span style="color: #ff7700;font-weight:bold;">for</span> w <span style="color: #ff7700;font-weight:bold;">in</span> r<span style="color: black;">&#91;</span><span style="color: #483d8b;">'permalink'</span><span style="color: black;">&#93;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'-'</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
                <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'%s (%s): %s'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>
                    name.<span style="color: black;">strip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>,
                    r<span style="color: black;">&#91;</span><span style="color: #483d8b;">'namespace'</span><span style="color: black;">&#93;</span>.<span style="color: black;">capitalize</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>,
                    r<span style="color: black;">&#91;</span><span style="color: #483d8b;">'crunchbase_url'</span><span style="color: black;">&#93;</span>,
                <span style="color: black;">&#41;</span>       
        <span style="color: #ff7700;font-weight:bold;">else</span>:
            <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'No results for &quot;%s&quot;'</span> <span style="color: #66cc66;">%</span> q
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Usage: python %s &lt;keyword(s)&gt;'</span> <span style="color: #66cc66;">%</span> <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Aquí tienen algunos resultados:</p>
<pre>mahadeva@blue:~$ python crunchbase.py
Usage: python crunchbase.py
mahadeva@blue:~$ python crunchbase.py popego
Popego (Company): http://www.crunchbase.com/company/popego
Santiago Siri (Person): http://www.crunchbase.com/person/santiago-siri
</pre>
<p>El programa en sí no es muy cómodo de usar (para eso existen los <em>add-ons</em> de de Firefox <img src='http://www.patriciomolina.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> ), pero es un buen punto de partida para utilizar, por ejemplo, como una <a href="http://www.djangoproject.com/">aplicación de Django</a>, o un <em>bot</em> que interactúe con <a href="http://www.twitter.com/">Twitter</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.patriciomolina.com/2009/09/consultando-crunchbase-con-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>You&#8217;ve got email! (versión Python)</title>
		<link>http://www.patriciomolina.com/2009/09/youve-got-email-version-python/</link>
		<comments>http://www.patriciomolina.com/2009/09/youve-got-email-version-python/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 03:04:51 +0000</pubDate>
		<dc:creator>Pato</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programación]]></category>

		<guid isPermaLink="false">http://www.patriciomolina.com/?p=67</guid>
		<description><![CDATA[Acá les muestro un simple notificador de correo con Python. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 import sys, libgmail &#160; def main&#40;&#41;: if len&#40;sys.argv&#41; &#62;= 3: g &#8230; <a href="http://www.patriciomolina.com/2009/09/youve-got-email-version-python/">Sigue leyendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Acá les muestro un simple notificador de correo con <a href="http://www.python.org/">Python</a>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>, libgmail
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&gt;</span>= <span style="color: #ff4500;">3</span>:
        g = libgmail.<span style="color: black;">GmailAccount</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>, <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">try</span>:
            g.<span style="color: black;">login</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">except</span> libgmail.<span style="color: black;">GmailLoginFailure</span>:
            <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Login incorrecto'</span>
        <span style="color: #ff7700;font-weight:bold;">else</span>:
            unread = g.<span style="color: black;">getUnreadMsgCount</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">if</span> unread:
                <span style="color: #ff7700;font-weight:bold;">import</span> pynotify, gtk
                pynotify.<span style="color: black;">init</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Gmail notify'</span><span style="color: black;">&#41;</span>
                pynotify.<span style="color: black;">Notification</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Gmail'</span>, <span style="color: #483d8b;">'%d mensajes sin leer'</span> <span style="color: #66cc66;">%</span> unread,
                    gtk.<span style="color: black;">STOCK_DIALOG_INFO</span><span style="color: black;">&#41;</span>.<span style="color: black;">show</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>En la primera línea estoy importando el módulo <a href="http://pypi.python.org/pypi/libgmail/0.0.8">libgmail</a> porque uso <a href="http://mail.google.com/">Gmail</a>. Si usan <a href="http://www.ubuntu.com/">Ubuntu</a>, pueden instalar esta librería con <tt>sudo apt-get install python-libgmail</tt>.</p>
<p>Alternativamente pueden obtener un <a href="http://es.wikipedia.org/wiki/XML">XML</a> en formato <a href="http://es.wikipedia.org/wiki/Atom_(formato_de_redifusi%C3%B3n)">Atom</a> a través de <a href="https://mail.google.com/mail/feed/atom">https://mail.google.com/mail/feed/atom</a> (van a necesitar  algo como <tt><a href="http://docs.python.org/library/urllib2.html#urllib2.HTTPPasswordMgrWithDefaultRealm">urllib2.HTTPPasswordMgrWithDefaultRealm</a></tt>).</p>
<p>Como es un <em>script</em> que se ejecuta desde la línea de comandos, <tt>sys.argv[1]</tt> será mi nombre de usuario y <tt>sys.argv[2]</tt> mi contraseña.</p>
<p>Si en mi cuenta hay correo no leído (línea 12), importo pynotify y gtk (porque uso <a href="http://www.gnome.org/">Gnome</a>) para mostrar un mensaje en mi pantalla:</p>
<p><img src="http://www.patriciomolina.com/wp-content/uploads/2009/09/notificacion.png" alt="notificacion" title="notificacion" width="310" height="128" class="aligncenter size-full wp-image-82" /></p>
<p>Dos cosas a tener en cuenta:</p>
<ul>
<li>En el ejemplo utilizo <tt>sys.argv</tt> para obtener el nombre de usuario y la contraseña, pero tengan en cuenta que esa información queda almacenada en <tt>~/.bash_history</tt> o en otros <em>logs</em> del sistema. Es preferible definir dos variables dentro del <em>script</em></li>
<li>Pueden hacer que el <em>script</em> corra periódicamente utilizando <a href="http://es.wikipedia.org/wiki/Cron_(Unix)">cron</a>. Por ejemplo: <tt>*/1 * * * * /usr/bin/python2.5 /path/al/script.py usuario@gmail.com contraseña</tt></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.patriciomolina.com/2009/09/youve-got-email-version-python/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Extremists in the free software world</title>
		<link>http://www.patriciomolina.com/2009/07/extremists-in-the-free-software-world/</link>
		<comments>http://www.patriciomolina.com/2009/07/extremists-in-the-free-software-world/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 18:12:13 +0000</pubDate>
		<dc:creator>Pato</dc:creator>
				<category><![CDATA[Citas]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[free software]]></category>

		<guid isPermaLink="false">http://www.patriciomolina.com/?p=38</guid>
		<description><![CDATA[There are &#8216;extremists&#8217; in the free software world, but that&#8217;s one major reason why I don&#8217;t call what I do &#8216;free software&#8217; any more. I don&#8217;t want to be associated with the people for whom it&#8217;s about exclusion and hatred. &#8230; <a href="http://www.patriciomolina.com/2009/07/extremists-in-the-free-software-world/">Sigue leyendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<blockquote><p>There are &#8216;extremists&#8217; in the free software world, but that&#8217;s one major reason why I don&#8217;t call what I do &#8216;free software&#8217; any more. I don&#8217;t want to be associated with the people for whom it&#8217;s about exclusion and hatred.</p></blockquote>
<p style="text-align: right;"><a href="http://es.wikipedia.org/wiki/Linus_Torvalds">Linus Torvalds</a>, en <a href="http://www.linux-mag.com/cache/7439/1.html">Linux Magazine</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.patriciomolina.com/2009/07/extremists-in-the-free-software-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

