<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>code danilat</title>
    <description>Mi blog de código</description>
    <link>http://code.danilat.com/</link>
    <atom:link href="http://code.danilat.com/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Sun, 25 Oct 2015 21:40:20 +0000</pubDate>
    <lastBuildDate>Sun, 25 Oct 2015 21:40:20 +0000</lastBuildDate>
    <generator>Jekyll v2.4.0</generator>
    
      <item>
        <title>Personalizando la encriptación de devise</title>
        <description>&lt;p&gt;Como se pueden haber visto durante muchas de &lt;a href=&quot;http://www.danilat.com/weblog/category/general/retro-semanal/&quot;&gt;mis retros semanales&lt;/a&gt;, estuve trabajando en la migración de la tienda online de &lt;strong&gt;&lt;a href=&quot;http://www.bichomania.es/&quot;&gt;Bichomanía&lt;/a&gt;&lt;/strong&gt;, de una plataforma desarrollada a medida había que pasar a una basada en &lt;a href=&quot;https://spreecommerce.com/&quot;&gt;Spree&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Pues bien, una de las cosas que había que traer eran los datos de clientes ya existentes y que no tuvieran que crearse un nuevo usuario. Vamos, que se mantuviera su contraseña, por lo que había que mantener el mismo algoritmo de encriptación.&lt;/p&gt;

&lt;p&gt;Como puede ser de suponer, Spree utiliza por debajo la gema de &lt;a href=&quot;https://github.com/plataformatec/devise&quot;&gt;devise&lt;/a&gt; para estas cuestiones. De modo que suponía que alguna forma habría de adaptarlo, y así fue, &lt;a href=&quot;https://github.com/plataformatec/devise/wiki/How-To:-Create-a-custom-encryptor&quot;&gt;había documentación de ello&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Así que creé mi propio encryptor, de este estilo:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#config/initializers/custom_encryptor.rb&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;digest&amp;#39;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Devise&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Encryptable&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Encryptors&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;CustomEncryptor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;digest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stretches&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;salt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pepper&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;no&quot;&gt;Digest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;SHA256&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;hexdigest&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Vale, una vez hecho esto me encontré con que tenía que extender la clase &lt;em&gt;Spree::User&lt;/em&gt;, ya que no tengo un modelo usuario en mi aplicación como ponía en la documentación de devise. En la documentación de spree explican &lt;a href=&quot;https://guides.spreecommerce.com/developer/authentication.html#the-user-model&quot;&gt;cómo utilizar un modelo usuario propio&lt;/a&gt;, pero vi que era un escenario en el que podía ser más limpio hacer uso de las posibilidades de metaprogramación que nos ofrece ruby.&lt;/p&gt;

&lt;p&gt;De modo que lo que haríamos en un modelo propio, lo añadimos vía el uso de &lt;em&gt;&lt;a href=&quot;http://apidock.com/ruby/Module/class_eval&quot;&gt;class_eval&lt;/a&gt;&lt;/em&gt;. Y quedaría algo así:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#app/models/user_decorator.rb&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;Spree&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;class_eval&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  
  &lt;span class=&quot;c1&quot;&gt;#le decimos que use nuestro encryptor&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;devise&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:encryptable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:encryptor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:custom_encryptor&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;#sobreescribimos el método de validación del password&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;valid_password?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;no&quot;&gt;Devise&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;secure_compare&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;no&quot;&gt;Devise&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Encryptable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Encryptors&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;CustomEncryptor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;digest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
      &lt;span class=&quot;nb&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;encrypted_password&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;#como no hacemos uso de salt para encriptar el password, machacamos el getter y setter&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;password_salt&lt;/span&gt;
  &lt;span class=&quot;s1&quot;&gt;&amp;#39;no salt&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;password_salt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new_salt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Profit.&lt;/p&gt;
</description>
        <pubDate>Sun, 25 Oct 2015 00:00:00 +0000</pubDate>
        <link>http://code.danilat.com/rails/2015/10/25/personalizar-devise/</link>
        <guid isPermaLink="true">http://code.danilat.com/rails/2015/10/25/personalizar-devise/</guid>
        
        
        <category>rails</category>
        
      </item>
    
      <item>
        <title>On Messaging</title>
        <description>&lt;p&gt;&lt;code&gt;The big idea is &amp;quot;messaging&amp;quot;... The key in making great and growable systems is much more to design how its modules communicate rather than what their internal properties and behaviors should be.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://c2.com/cgi/wiki?AlanKayOnMessaging&quot;&gt;Alan Kay (1998)&lt;/a&gt;. Citado en &lt;a href=&quot;http://www.amazon.es/Growing-Object-Oriented-Software-Guided-Signature/dp/0321503627%3FSubscriptionId%3DAKIAIJEHBJ4SYF65HIPQ%26tag%3Dpricetrack0b-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0321503627&quot;&gt;Growing Object-Oriented Software&lt;/a&gt;.&lt;/p&gt;
</description>
        <pubDate>Thu, 03 Sep 2015 00:00:00 +0000</pubDate>
        <link>http://code.danilat.com/code/2015/09/03/alan-kay-on-messaging/</link>
        <guid isPermaLink="true">http://code.danilat.com/code/2015/09/03/alan-kay-on-messaging/</guid>
        
        
        <category>code</category>
        
      </item>
    
      <item>
        <title>Requests y Selenium sobre Tor</title>
        <description>&lt;p&gt;¿Conoces el &lt;a href=&quot;https://www.torproject.org/about/overview.html.en&quot;&gt;proyecto Tor&lt;/a&gt;? Me extrañaría que no lo hubieras visto alguna vez demonizado en medios de comunicación o alabado en sitios &lt;em&gt;geek&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/tor-google.png&quot; alt=&quot;Sugerencias de google al buscar Tor&quot;&gt;&lt;/p&gt;

&lt;p&gt;Básicamente es un proyecto que permite conectarse a internet con mayor seguridad y privacidad implementando &lt;strong&gt;Onion Routing&lt;/strong&gt;, hay montones de información de este proyecto para quien quiera profundizar sobre ello, cosa que no es mi intención en esta anotación.&lt;/p&gt;

&lt;p&gt;La cuestión es que he estado hace unos días experimentando con Tor y 2 herramientas que uso habitualmente para automatizar tareas de navegación repetitivas con Python: &lt;a href=&quot;https://selenium-python.readthedocs.org/&quot;&gt;Selenium&lt;/a&gt; y &lt;a href=&quot;http://docs.python-requests.org/en/latest/&quot;&gt;Requests&lt;/a&gt;. &lt;/p&gt;

&lt;h3 id=&quot;instalación-de-tor&quot;&gt;Instalación de tor&lt;/h3&gt;

&lt;p&gt;En mi caso, en Mac OS usé homebrew para instalar tor. Para otras opciones hay un puñado de &lt;a href=&quot;https://www.torproject.org/docs/installguide.html.en&quot;&gt;guías de instalación&lt;/a&gt;. &lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;brew install tor&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Ejecutando el comando &lt;strong&gt;tor&lt;/strong&gt; ya tendremos el servicio corriendo.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;tor&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id=&quot;usándolo-con-selenium&quot;&gt;Usándolo con Selenium&lt;/h3&gt;

&lt;p&gt;Bien, no hemos tocado ningún tipo de configuración. Vayamos a por Selenium con el driver de Firefox, modificando algunas preferencias del profile. Le diremos que usamos un proxy manual y que va por protocolo &lt;a href=&quot;http://es.wikipedia.org/wiki/SOCKS&quot;&gt;SOCKS&lt;/a&gt; a una IP y al puerto de tor. En este ejemplo la IP de loopback y al puerto por defecto, el 9050.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;selenium&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;webdriver&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;profile&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;webdriver&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FirefoxProfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;profile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set_preference&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;network.proxy.type&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;profile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set_preference&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;network.proxy.socks&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;127.0.0.1&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;profile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set_preference&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;network.proxy.socks_port&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9050&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;driver&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;webdriver&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Firefox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;profile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;http://estoeslapollaconcebol.la&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id=&quot;requests-no-requesocks&quot;&gt;Requests no, Requesocks!&lt;/h3&gt;

&lt;p&gt;Pero bueno, igual queremos usar algo de más bajo nivel que un navegador web. Siguiendo con python, estuve viendo si con requests podría llegar a utlizarlo, cosa que no es posible ya que al parecer no es posible trabajar con socks. Por suerte, al ser requests &lt;em&gt;open source&lt;/em&gt;, existe un &lt;em&gt;fork&lt;/em&gt; del proyecto llamado &lt;a href=&quot;https://github.com/dvska/requesocks&quot;&gt;Requesocks&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Lo bueno es que el API es igualita a Requests, no hay diferencia en la forma de usarlo (la único incompatibilidad que encontré fue el poder usar el parámetro &lt;em&gt;stream&lt;/em&gt; en una petición, desconozco la razón); y como el paquete simplemente está renombrado no hay problema en usar uno u otro.&lt;/p&gt;

&lt;p&gt;En fin, al turrón. Una vez instalado requesocks iniciaremos una sesión a la que le pasaremos los proxies para las peticiones http y https indicando de nuevo IP de loopback y el puerto 9050.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;requesocks&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;session&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;requesocks&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;session&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;session&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;proxies&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;http&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;socks5://127.0.0.1:9050&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;https&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;socks5://127.0.0.1:9050&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;session&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;http://avecesllorocortandocebol.la&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;A partir de este momento usaríamos tor como proxy de todas nuestras peticiones y acciones de navegación que ejecutáramos automáticamente. Para estas cuestiones quedaría pendiente ver qué tal se entiende &lt;a href=&quot;http://scrapy.org/&quot;&gt;Scrapy&lt;/a&gt; con tor, pero no es algo a lo que le haya dedicado ningún tiempo.&lt;/p&gt;
</description>
        <pubDate>Thu, 12 Mar 2015 00:00:00 +0000</pubDate>
        <link>http://code.danilat.com/python/2015/03/12/ejecutando-requests-y-selenium-sobre-tor/</link>
        <guid isPermaLink="true">http://code.danilat.com/python/2015/03/12/ejecutando-requests-y-selenium-sobre-tor/</guid>
        
        
        <category>python</category>
        
      </item>
    
      <item>
        <title>Pon jekyll en tu vida</title>
        <description>&lt;p&gt;En &lt;a href=&quot;http://senpaidevs.com&quot;&gt;SenpaiDevs&lt;/a&gt; hemos propuesto a los kōhais que se crearan su propio blog para que vayan compartiendo sus avances, y para aprovechar para empezar a practicar con git y github decidimos tirar por &lt;a href=&quot;http://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt;, un CMS basado en ficheros de texto.&lt;/p&gt;

&lt;p&gt;Antes de instalarlo hay que tener ruby ya instalado en el sistema, ya que jekyll se instala como una gema, también hay que tener nodejs (al parecer también soporta otros runtime JS).&lt;/p&gt;

&lt;p&gt;Luego simplemente instalamos la gema.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;gem install jekyll&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Una vez instalado, en el directorio donde se quiera trabajar se ejecuta &lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;jekyll new blog
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;blog
jekyll serve&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Y en cuanto veamos&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Es que ya está corriendo y podremos ver el blog, dentro del directorio &lt;strong&gt;_posts&lt;/strong&gt; escribiremos los posts en formato &lt;em&gt;&lt;a href=&quot;http://daringfireball.%20net/projects/markdown/&quot;&gt;markdown&lt;/a&gt;&lt;/em&gt;. El nombre de los ficheros de los posts deben empezar con el formato de fecha &lt;em&gt;yyyy-MM-dd&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Como hemos dicho que lo íbamos a hospedar en github, hay que inicializar el repositorio y hacer los commits necesarios. Tras ello hay que crearse un repositorio con el formato &lt;em&gt;tuusername.github.io&lt;/em&gt; en github y añadirlo como remoto. A partir de ese momento al hacer &lt;em&gt;push&lt;/em&gt; se publicará el blog en esa &lt;em&gt;tuusername.github.io&lt;/em&gt;.&lt;/p&gt;

&lt;h3 id=&quot;bonus-track&quot;&gt;Bonus track&lt;/h3&gt;

&lt;p&gt;Como se puede ver, en este blog tengo mi propio dominio. Para hacerlo es bastante simple: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creamos un fichero llamado &lt;em&gt;CNAME&lt;/em&gt; en el directorio raíz del blog y ahí ponemos el dominio o subdominio que queramos&lt;/li&gt;
&lt;li&gt;En nuestro proveedor de DNS añadimos un registro de tipo CNAME que apunte a &lt;em&gt;tuusername.github.io&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;y-listo&quot;&gt;Y listo!&lt;/h3&gt;

&lt;p&gt;Ya podemos empezar a publicar posts escritos en ficheros de texto con markdown y publicarlos con git en github, un rollete bastante geek ¿que no?&lt;/p&gt;
</description>
        <pubDate>Fri, 27 Feb 2015 00:00:00 +0000</pubDate>
        <link>http://code.danilat.com/jekyll/2015/02/27/pon-jekyll-en-tu-vida/</link>
        <guid isPermaLink="true">http://code.danilat.com/jekyll/2015/02/27/pon-jekyll-en-tu-vida/</guid>
        
        
        <category>jekyll</category>
        
      </item>
    
      <item>
        <title>Hello World</title>
        <description>&lt;p&gt;Ya venía un tiempo pensando en montar un blog sobre código. Con posts seguramente no excesivamente elaborados, rollo recetas muy concretas o recordatorios puntuales para mi yo futuro. Escritos de modo que también pueda servir a otras personas.&lt;/p&gt;

&lt;p&gt;Y bueno, como esto va de código, esto es el clásico Hello World en ruby&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Hello World&amp;#39;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
</description>
        <pubDate>Tue, 24 Feb 2015 00:00:00 +0000</pubDate>
        <link>http://code.danilat.com/2015/02/24/hello-world/</link>
        <guid isPermaLink="true">http://code.danilat.com/2015/02/24/hello-world/</guid>
        
        
      </item>
    
  </channel>
</rss>
