<?xml version='1.0' encoding='utf-8' ?>
<feed xmlns='http://www.w3.org/2005/Atom'>
  <title type='text'>Bdunk</title>
  <generator uri='http://nestacms.com'>Nesta</generator>
  <id>tag:www.bdunk.com,2009:/</id>
  <link href='http://www.bdunk.com/articles.xml' rel='self' />
  <link href='http://www.bdunk.com/' rel='alternate' />
  <subtitle type='text'>- We are on standby -</subtitle>
  <updated>2013-05-06T00:00:00+00:00</updated>
  <entry>
    <title>Arduino from shell</title>
    <link href='http://www.bdunk.com/arduino-upload-from-shell' rel='alternate' type='text/html' />
    <id>tag:www.bdunk.com,2013-05-06:/arduino-upload-from-shell</id>
    <content type='html'>
      &lt;p&gt;If you want to upload a program to Arduino from the command line can be done with &lt;a href=&quot;http://inotool.org/&quot;&gt;inotool&lt;/a&gt;.&lt;/p&gt;
      
      &lt;p&gt;First install dependences:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;apt-get install python-setuptools&amp;#x000A;apt-get install python-configobj&amp;#x000A;apt-get install python-jinja2&amp;#x000A;apt-get install python-serial&lt;/code&gt;&lt;/pre&gt;
      
      
      &lt;p&gt;For serial tests:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;apt-get install picocom&lt;/code&gt;&lt;/pre&gt;
      
      
      &lt;p&gt;Obtain source and compile it:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;git clone git://github.com/amperka/ino.git&amp;#x000A;make install&lt;/code&gt;&lt;/pre&gt;
      
      
      &lt;p&gt;Start a project:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;mkdir blink&amp;#x000A;cd blink&amp;#x000A;ino init&lt;/code&gt;&lt;/pre&gt;
      
      
      &lt;p&gt;Change it src/sketch.ino with your program. A sample:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;#define LED_PIN 13&amp;#x000A;&amp;#x000A;void setup()&amp;#x000A;{&amp;#x000A;    pinMode(LED_PIN, OUTPUT);&amp;#x000A;}&amp;#x000A;&amp;#x000A;void loop()&amp;#x000A;{&amp;#x000A;    digitalWrite(LED_PIN, HIGH);&amp;#x000A;    delay(100);&amp;#x000A;    digitalWrite(LED_PIN, LOW);&amp;#x000A;    delay(900);&amp;#x000A;}&lt;/code&gt;&lt;/pre&gt;
      
      
      &lt;p&gt;In my case I'm using Arduino Duemilanove so I created a configuration file ino.ini (in the same project folder):&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;[build]&amp;#x000A;board-model = atmega328&amp;#x000A;&amp;#x000A;[upload]&amp;#x000A;board-model = atmega328&lt;/code&gt;&lt;/pre&gt;
      
      
      &lt;p&gt;You will need arduino-core:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;apt-get install arduino-core&lt;/code&gt;&lt;/pre&gt;
      
      
      &lt;p&gt;Build project&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;ino build&lt;/code&gt;&lt;/pre&gt;
      
      
      &lt;p&gt;And now upload to Arduino:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;ino upload&lt;/code&gt;&lt;/pre&gt;
      
      
      &lt;p&gt;My Arduino:&lt;/p&gt;
      
      &lt;p&gt;&lt;img src=&quot;/attachments/arduino_test.jpg&quot; title=&quot;My Arduino&quot; alt=&quot;My Arduino&quot; /&gt;&lt;/p&gt;
      
      &lt;p&gt;You can see a good tutorial &lt;a href=&quot;http://inotool.org/quickstart&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
    </content>
    <published>2013-05-06T00:00:00+00:00</published>
    <updated>2013-05-06T00:00:00+00:00</updated>
    <category term='arduino'></category>
  </entry>
  <entry>
    <title>123: The Black Hole Number</title>
    <link href='http://www.bdunk.com/123-number' rel='alternate' type='text/html' />
    <id>tag:www.bdunk.com,2013-02-22:/123-number</id>
    <content type='html'>
      &lt;ul&gt;
      &lt;li&gt;Start with any number, say 9288759&lt;/li&gt;
      &lt;li&gt;Count the number of even digits, the number of odd digits, the total number of digits.&lt;/li&gt;
      &lt;li&gt;You get 347&lt;/li&gt;
      &lt;li&gt;Repeat and you get 123&lt;/li&gt;
      &lt;li&gt;Repeat and you get 123&lt;/li&gt;
      &lt;li&gt;Repeat and you get 123&lt;/li&gt;
      &lt;li&gt;...&lt;/li&gt;
      &lt;li&gt;Once you reach 123, you never get out, just as reaching a black hole in physics implies no escape.&lt;/li&gt;
      &lt;/ul&gt;
      
      
      &lt;p&gt;A simple program in Node JS to test:&lt;/p&gt;
      
      &lt;p&gt;&lt;code&gt;&lt;pre&gt;/&lt;em&gt;&amp;#x000A;Moncho Pena&amp;#x000A;2013-02-22&amp;#x000A;&lt;/em&gt;/&amp;#x000A;var myargs = process.argv.slice(2);&amp;#x000A;if (myargs[0]) {&amp;#x000A;var number=myargs[0];&amp;#x000A;number=stripAlphaChars(number);&amp;#x000A;if (number=='') {&amp;#x000A;number=0;&amp;#x000A;}&amp;#x000A;if (number&amp;lt;100) {&amp;#x000A;console.log('Please use a number greater than 99');&amp;#x000A;} else {&amp;#x000A;console.log(number);&amp;#x000A;var test=convert(number);&amp;#x000A;while (test[3]!=123) {&amp;#x000A;test=convert(test[3]);&amp;#x000A;}&amp;#x000A;}&amp;#x000A;} else {&amp;#x000A;console.log('Use: node 123.js number');&amp;#x000A;}&amp;#x000A;function stripAlphaChars(source) {&amp;#x000A;var out = source.replace(/[&lt;sup&gt;0-9]/g,&lt;/sup&gt; '');&amp;#x000A;return out;&amp;#x000A;}&amp;#x000A;function convert(number) {&amp;#x000A;var numbers= new Array();&amp;#x000A;var res= new Array();&amp;#x000A;var pair=0;&amp;#x000A;var odd=0;&amp;#x000A;for (var i=0;i&amp;lt;number.length;i++) {&amp;#x000A;var control=number.substr(i, 1);&amp;#x000A;if ((control%2)==0) {&amp;#x000A;pair++;&amp;#x000A;} else {&amp;#x000A;odd++;&amp;#x000A;}&amp;#x000A;}&amp;#x000A;res[0]=pair;&amp;#x000A;res[1]=odd;&amp;#x000A;res[2]=number.length;&amp;#x000A;var super_number=res[0].toString()+res[1].toString()+res[2].toString();&amp;#x000A;console.log(super_number);&amp;#x000A;res[3]=super_number;&amp;#x000A;return res;&amp;#x000A;}&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;
      
      &lt;p&gt;Running:&lt;/p&gt;
      
      &lt;p&gt;&lt;img src=&quot;/attachments/123.png&quot; title=&quot;123.js Screenshot&quot; alt=&quot;123.js Screenshot&quot; /&gt;&lt;/p&gt;
      
      &lt;p&gt;I've read this curiosity on &lt;a href=&quot;http://gaussianos.com/una-curiosa-propiedad-del-123/&quot;&gt;Gaussianos&lt;/a&gt;.&lt;/p&gt;
    </content>
    <published>2013-02-22T00:00:00+00:00</published>
    <updated>2013-02-22T00:00:00+00:00</updated>
    <category term='development'></category>
  </entry>
  <entry>
    <title>Every Possible Photograph in Processing</title>
    <link href='http://www.bdunk.com/processing-image' rel='alternate' type='text/html' />
    <id>tag:www.bdunk.com,2013-02-11:/processing-image</id>
    <content type='html'>
      &lt;p&gt;I read in &lt;a href=&quot;http://www.microsiervos.com/archivo/arte-y-diseno/todas-las-fotografias-posibles.html&quot;&gt;Microsiervos&lt;/a&gt; an interesting article about &lt;a href=&quot;http://www.jeffreythompson.org/EveryPossiblePhotograph.php&quot;&gt;Every Possible Photograph&lt;/a&gt;.&lt;/p&gt;
      
      &lt;p&gt;I made a Processing program that generates a random image each time you make a click.&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;//Globals&amp;#x000A;&amp;#x000A;int w=800;&amp;#x000A;int h=600;&amp;#x000A;  &amp;#x000A;int block_x = 10;&amp;#x000A;int block_y = 10;&amp;#x000A;  &amp;#x000A;int blocks_x=ceil(w/block_x);&amp;#x000A;int blocks_y=ceil(h/block_y);&amp;#x000A;&amp;#x000A;void setup() {  &amp;#x000A;  size(w, h);&amp;#x000A;}&amp;#x000A;&amp;#x000A;void draw() {&amp;#x000A;  &amp;#x000A;  if (mousePressed) {&amp;#x000A;    makeit();&amp;#x000A;  } &amp;#x000A;  &amp;#x000A;}&amp;#x000A;&amp;#x000A;void makeit() {&amp;#x000A;  &amp;#x000A;  for (int i=0;i&amp;lt;blocks_y;i++) {&amp;#x000A;&amp;#x000A;    int coord_y=i*block_y;&amp;#x000A;  &amp;#x000A;    for (int w=0;w&amp;lt;blocks_x;w++) {&amp;#x000A;      int coord_x=w*block_x;&amp;#x000A;      color c1 = color(random(0,255), random(0,255), random(0,255));&amp;#x000A;      fill(c1);&amp;#x000A;      rect(coord_x, coord_y, coord_x+block_x, coord_y+block_y);&amp;#x000A;    }&amp;#x000A;    &amp;#x000A;  }&amp;#x000A;&amp;#x000A;}&lt;/code&gt;&lt;/pre&gt;
      
      
      &lt;p&gt;&lt;img src=&quot;/attachments/processing_all_image.png&quot; title=&quot;Processing Screenshot&quot; alt=&quot;Processing Screenshot&quot; /&gt;&lt;/p&gt;
      
      &lt;p&gt;What is the possibility of hitting a recognizable image? :-)&lt;/p&gt;
    </content>
    <published>2013-02-11T00:00:00+00:00</published>
    <updated>2013-02-11T00:00:00+00:00</updated>
    <category term='development'></category>
  </entry>
  <entry>
    <title>TWiki on Nginx</title>
    <link href='http://www.bdunk.com/twiki-nginx' rel='alternate' type='text/html' />
    <id>tag:www.bdunk.com,2012-12-22:/twiki-nginx</id>
    <content type='html'>
      &lt;p&gt;I like &lt;a href=&quot;http://twiki.org/&quot;&gt;Twiki&lt;/a&gt; and I love &lt;a href=&quot;http://nginx.org/&quot;&gt;Nginx&lt;/a&gt;. Can they work together? Yes they can.&lt;/p&gt;
      
      &lt;p&gt;First: we need a CGI for Nginx.
      I used to use &lt;a href=&quot;https://github.com/kindy61/spawn-fcgi&quot;&gt;spawn-fcgi&lt;/a&gt; but is not updated for 4 years. So i tried with &lt;a href=&quot;http://nginx.localdomain.pl/wiki/FcgiWrap&quot;&gt;Simple CGI support for Nginx&lt;/a&gt;.&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;git clone https://github.com/gnosek/fcgiwrap&amp;#x000A;autoreconf -i&amp;#x000A;./configure&amp;#x000A;make&amp;#x000A;make install&lt;/code&gt;&lt;/pre&gt;
      
      
      &lt;p&gt;Maybe you need install:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;apt-get install libfcgi-dev&lt;/code&gt;&lt;/pre&gt;
      
      
      &lt;p&gt;A script for start FCGIWrap&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;#!/usr/bin/perl&amp;#x000A;&amp;#x000A;use strict;&amp;#x000A;use warnings FATAL =&gt; qw( all );&amp;#x000A;&amp;#x000A;use IO::Socket::UNIX;&amp;#x000A;&amp;#x000A;my $bin_path = '/usr/local/sbin/fcgiwrap';&amp;#x000A;my $socket_path = $ARGV[0] || '/tmp/cgi.sock';&amp;#x000A;my $num_children = $ARGV[1] || 1;&amp;#x000A;&amp;#x000A;close STDIN;&amp;#x000A;&amp;#x000A;unlink $socket_path;&amp;#x000A;my $socket = IO::Socket::UNIX-&gt;new(&amp;#x000A;    Local =&gt; $socket_path,&amp;#x000A;    Listen =&gt; 100,&amp;#x000A;);&amp;#x000A;&amp;#x000A;die &quot;Cannot create socket at $socket_path: $!\n&quot; unless $socket;&amp;#x000A;&amp;#x000A;for (1 .. $num_children) {&amp;#x000A;    my $pid = fork;&amp;#x000A;    die &quot;Cannot fork: $!&quot; unless defined $pid;&amp;#x000A;    next if $pid;&amp;#x000A;&amp;#x000A;    exec $bin_path;&amp;#x000A;    die &quot;Failed to exec $bin_path: $!\n&quot;;&amp;#x000A;}&lt;/code&gt;&lt;/pre&gt;
      
      
      &lt;p&gt;Now install TWiki. Obtain source from &lt;a href=&quot;http://twiki.org/cgi-bin/view/Codev/DownloadTWiki?&quot;&gt;TWike Download Page&lt;/a&gt;.&lt;/p&gt;
      
      &lt;p&gt;Create LocalLib.cfg and put all path (In my case):&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$twikiLibPath = &quot;/var/twiki/lib&quot;;&amp;#x000A;$TWiki::cfg{ScriptUrlPaths}{view} = '';&amp;#x000A;$TWiki::cfg{ScriptUrlPaths}{edit} = '/edit';&lt;/code&gt;&lt;/pre&gt;
      
      
      &lt;p&gt;And now nginx configuration:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;server {&amp;#x000A;        listen       81;&amp;#x000A;        server_name  192.168.1.113;&amp;#x000A;        &amp;#x000A;        access_log /var/log/nginx/acces_twiki.log;&amp;#x000A;        error_log /var/log/nginx/error_twiki.log;&amp;#x000A;&amp;#x000A;         root /var/twiki;&amp;#x000A;        index index.html;&amp;#x000A;        &amp;#x000A;        location = /favicon.ico {&amp;#x000A;          return 204;&amp;#x000A;          access_log     off;&amp;#x000A;          log_not_found  off;&amp;#x000A;        }&amp;#x000A;&amp;#x000A;&amp;#x000A;        rewrite ^/([A-Z].*)  /bin/view/$1;&amp;#x000A;        rewrite ^/edit/(.*)  /bin/edit/$1;&amp;#x000A;&amp;#x000A;        location ~ ^/pub/ { allow all; }&amp;#x000A;&amp;#x000A;        location ~ ^/bin/configure {&amp;#x000A;          allow all; #remember put deny all after finish configuration&amp;#x000A;          fastcgi_pass   unix:/tmp/cgi.sock;&amp;#x000A;          include        fastcgi_params;&amp;#x000A;          fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;&amp;#x000A;        }&amp;#x000A;&amp;#x000A;        location ~ ^/bin/ {&amp;#x000A;          allow all;&amp;#x000A;          fastcgi_pass   unix:/tmp/cgi.sock;&amp;#x000A;          fastcgi_split_path_info  ^(/bin/[^/]+)(/.*)$;&amp;#x000A;          include        fastcgi_params;&amp;#x000A;          fastcgi_param  PATH_INFO        $fastcgi_path_info;&amp;#x000A;          fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;&amp;#x000A;         }&amp;#x000A;&amp;#x000A;    }&lt;/code&gt;&lt;/pre&gt;
      
      
      &lt;p&gt;And go to web page!&lt;/p&gt;
      
      &lt;p&gt;&lt;img src=&quot;/attachments/twiki_screenshot.png&quot; title=&quot;TWiki Screenshot&quot; alt=&quot;TWiki Screenshot&quot; /&gt;&lt;/p&gt;
    </content>
    <published>2012-12-22T00:00:00+00:00</published>
    <updated>2012-12-22T00:00:00+00:00</updated>
    <category term='development'></category>
  </entry>
  <entry>
    <title>How to change prompt colour and motd</title>
    <link href='http://www.bdunk.com/motd-linux' rel='alternate' type='text/html' />
    <id>tag:www.bdunk.com,2012-11-30:/motd-linux</id>
    <content type='html'>
      &lt;p&gt;When you work (hard) with many servers on terminal you need to distinguish them. The best way is.&lt;/p&gt;
      
      &lt;h2&gt;Set the prompt&lt;/h2&gt;
      
      &lt;p&gt;Add line to .bashrc:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;export PS1=&quot;\e[1;36m\u@\h-super-dev-\w# \e[m&quot;&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Don't forget reload file:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;source .bashrc&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Ok there are lots of colours.&lt;/p&gt;
      
      &lt;p&gt;&lt;img src=&quot;/attachments/bashcolor.png&quot; title=&quot;Bash Colour&quot; alt=&quot;bashcolor&quot; /&gt;&lt;/p&gt;
      
      &lt;p&gt;A list:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;Black       0;30     Dark Gray     1;30&amp;#x000A;Blue        0;34     Light Blue    1;34&amp;#x000A;Green       0;32     Light Green   1;32&amp;#x000A;Cyan        0;36     Light Cyan    1;36&amp;#x000A;Red         0;31     Light Red     1;31&amp;#x000A;Purple      0;35     Light Purple  1;35&amp;#x000A;Brown       0;33     Yellow        1;33&amp;#x000A;Light Gray  0;37     White         1;37&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;h2&gt;Changing the motd file&lt;/h2&gt;
      
      &lt;p&gt;When you start system you can change initial message in /etc/motd. &lt;em&gt;Mental note&lt;/em&gt;: Don't forget make a copy when you change it.&lt;/p&gt;
      
      &lt;p&gt;And add colour to your live! Simple sample motd:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;[moncho@bdunk.com]$ echo -en &quot;\033[1;34m&quot; &amp;gt; /etc/motd&amp;#x000A;[moncho@bdunk.com]$ echo &quot;Text of your motd file.....&quot; &amp;gt;&amp;gt; /etc/motd&amp;#x000A;[moncho@bdunk.com]$ echo -en &quot;\033[0m&quot; &amp;gt;&amp;gt; /etc/motd&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;You can add funny ASCII Artwors:&lt;/p&gt;
      
      &lt;p&gt;&lt;img src=&quot;/attachments/motd_star_wars.png&quot; title=&quot;/etc/motd starwars sample&quot; alt=&quot;motd_star_wars&quot; /&gt;&lt;/p&gt;
    </content>
    <published>2012-11-30T00:00:00+00:00</published>
    <updated>2012-11-30T00:00:00+00:00</updated>
    <category term='development'></category>
  </entry>
  <entry>
    <title>Using Markdown in Express</title>
    <link href='http://www.bdunk.com/markdown-jade' rel='alternate' type='text/html' />
    <id>tag:www.bdunk.com,2012-11-26:/markdown-jade</id>
    <content type='html'>
      &lt;p&gt;Ok. I'm a geek and I like &lt;a href=&quot;http://daringfireball.net/projects/markdown/&quot;&gt;markdown&lt;/a&gt;. I've been testing with Express and wanted to use &lt;a href=&quot;http://daringfireball.net/projects/markdown/&quot;&gt;markdown&lt;/a&gt;.&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ npm install -g express&amp;#x000A;$ express --sessions --css stylus myapp&amp;#x000A;$ cd myapp &amp;amp;&amp;amp; npm install&amp;#x000A;$ node app.js&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Now you can go to http://localhost:3000 and see The Express Default Page.&lt;/p&gt;
      
      &lt;p&gt;If we want use markdown we need install:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ npm install node-markdown&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Let's create a new markdown file into views:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ vi views/index.mdown&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Content:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;***Ok*** this is a test&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;In app.js file add this files:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;...&amp;#x000A;, fs = require('fs')&amp;#x000A;...&amp;#x000A;var md = require(&quot;node-markdown&quot;).Markdown;&amp;#x000A;...&amp;#x000A;var index_file = fs.readFileSync(__dirname + '/views/index.mdown', &quot;utf8&quot;);&amp;#x000A;app.locals.body = md(index_file);&amp;#x000A;...&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;In views change file index.jade adding:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;!{body}&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Wonderful! I really like &lt;a href=&quot;http://expressjs.com/&quot;&gt;express&lt;/a&gt;!&lt;/p&gt;
    </content>
    <published>2012-11-26T00:00:00+00:00</published>
    <updated>2012-11-26T00:00:00+00:00</updated>
    <category term='development'></category>
  </entry>
  <entry>
    <title>Sent an email when the iMac is at a specified price</title>
    <link href='http://www.bdunk.com/curl-apple' rel='alternate' type='text/html' />
    <id>tag:www.bdunk.com,2012-07-19:/curl-apple</id>
    <content type='html'>
      &lt;p&gt;The other day a friend asked me to let him know if I saw a special offer of iMac. I don't wanna be watching every little time so I made a script.&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;#!/bin/bash&amp;#x000A;&amp;#x000A;FILE=/root/no_mess&amp;#x000A;URL=&quot;http://store.apple.com/es/browse/home/specialdeals/mac/imac/27&quot;&amp;#x000A;PRICE=&quot;1.395&quot;&amp;#x000A;&amp;#x000A;if [ ! -f $FILE ]&amp;#x000A;then&amp;#x000A;&amp;#x000A;    LINE=`curl -s $URL | grep &quot;${PRICE}&quot;`&amp;#x000A;&amp;#x000A;    if [ -n &quot;${LINE}&quot; ]&amp;#x000A;    then&amp;#x000A;        echo &quot;Go to $URL&quot; | mail -s &quot;Ok let's go&quot; my.personal@email.com &amp;gt; $FILE&amp;#x000A;    fi&amp;#x000A;&amp;#x000A;fi&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;All that remains is to incorporate to the Cron.&lt;/p&gt;
    </content>
    <published>2012-07-19T00:00:00+00:00</published>
    <updated>2012-07-19T00:00:00+00:00</updated>
    <category term='development'></category>
  </entry>
  <entry>
    <title>How to know the outside temperature</title>
    <link href='http://www.bdunk.com/meteo' rel='alternate' type='text/html' />
    <id>tag:www.bdunk.com,2012-06-24:/meteo</id>
    <content type='html'>
      &lt;p&gt;From this web &lt;a href=&quot;http://www.meteogalicia.es/&quot;&gt;meteogalicia&lt;/a&gt; i can know the weather:&lt;/p&gt;
      
      &lt;p&gt;&lt;img src=&quot;/attachments/meteo.png&quot; title=&quot;Meteo Screenshot]&quot; alt=&quot;Meteo Screenshot&quot; /&gt;&lt;/p&gt;
      
      &lt;p&gt;If I only want see the degrees i use commands: &lt;em&gt;curl&lt;/em&gt;, &lt;em&gt;grep&lt;/em&gt; see and &lt;em&gt;awk&lt;/em&gt;.&lt;/p&gt;
      
      &lt;p&gt;&lt;img src=&quot;/attachments/curl_command.png&quot; title=&quot;Curl Screenshot&quot; alt=&quot;Curl Screenshot&quot; /&gt;&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;curl --silent --data &quot;idEst=10115&amp;amp;tiporede=automaticas&amp;amp;idprov=2&quot; http://www2.meteogalicia.es/galego/observacion/estacions/contidos/datosxeralestacion.asp | grep -m 1 &quot;deg&quot; | awk '{print $2}' | sed 's/class=&quot;negro&quot;&amp;gt;//' | sed 's/\&amp;amp;deg;&amp;lt;\/span&amp;gt;&amp;lt;\/td&amp;gt;//g'&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
    </content>
    <published>2012-06-24T00:00:00+00:00</published>
    <updated>2012-06-24T00:00:00+00:00</updated>
    <category term='development'></category>
  </entry>
  <entry>
    <title>How to publish an article on this website</title>
    <link href='http://www.bdunk.com/how-publish' rel='alternate' type='text/html' />
    <id>tag:www.bdunk.com,2012-06-10:/how-publish</id>
    <content type='html'>
      &lt;p&gt;First: I write the article in &lt;a href=&quot;http://daringfireball.net/projects/markdown/syntax&quot;&gt;*.mdown format&lt;/a&gt;.&lt;/p&gt;
      
      &lt;p&gt;&lt;img src=&quot;/attachments/coda.png&quot; title=&quot;Coda Screenshot&quot; alt=&quot;Coda Screenshot&quot; /&gt;&lt;/p&gt;
      
      &lt;p&gt;Second: I check on my computer everything works fine.&lt;/p&gt;
      
      &lt;blockquote&gt;&lt;p&gt;shotgun config.ru&lt;/p&gt;&lt;/blockquote&gt;
      
      &lt;p&gt;&lt;img src=&quot;/attachments/server_nesta_cms.png&quot; title=&quot;Nesta CMS server&quot; alt=&quot;Nesta Server Screenshot&quot; /&gt;&lt;/p&gt;
      
      &lt;p&gt;Third: login in heroku.&lt;/p&gt;
      
      &lt;blockquote&gt;&lt;p&gt;heroku login&lt;/p&gt;&lt;/blockquote&gt;
      
      &lt;p&gt;Fourth: update the code from server.&lt;/p&gt;
      
      &lt;blockquote&gt;&lt;p&gt;git pull&lt;/p&gt;&lt;/blockquote&gt;
      
      &lt;p&gt;Fifth: send to git server the changes.&lt;/p&gt;
      
      &lt;blockquote&gt;&lt;p&gt;git add .&lt;/p&gt;
      
      &lt;p&gt;git commit -a -m &quot;How to publish&quot;&lt;/p&gt;&lt;/blockquote&gt;
      
      &lt;p&gt;Sixth: send to heroku server.&lt;/p&gt;
      
      &lt;blockquote&gt;&lt;p&gt;git push heroku master&lt;/p&gt;&lt;/blockquote&gt;
      
      &lt;p&gt;More information about Heroku git in this &lt;a href=&quot;https://devcenter.heroku.com/articles/git&quot;&gt;page&lt;/a&gt;.&lt;/p&gt;
    </content>
    <published>2012-06-10T00:00:00+00:00</published>
    <updated>2012-06-10T00:00:00+00:00</updated>
    <category term='development'></category>
  </entry>
  <entry>
    <title>The sum of a sequence of odd numbers gives you the sequence for the perfect squares</title>
    <link href='http://www.bdunk.com/odd-property' rel='alternate' type='text/html' />
    <id>tag:www.bdunk.com,2012-06-06:/odd-property</id>
    <content type='html'>
      &lt;p&gt;Really? We can test with a simple PHP Code:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;&amp;lt;?php&amp;#x000A;&amp;#x000A;echo '&amp;lt;h1&amp;gt;The sum of a sequence of odd numbers gives you the sequence for the perfect squares&amp;lt;/h1&amp;gt;';&amp;#x000A;&amp;#x000A;//The limit&amp;#x000A;$limit=1000;&amp;#x000A;&amp;#x000A;$odd=array();&amp;#x000A;&amp;#x000A;for ($i=1;$i&amp;lt;$limit;$i++) {&amp;#x000A;&amp;#x000A;    if ($i%2!=0) {&amp;#x000A;        $odd[]=$i;&amp;#x000A;    }&amp;#x000A;&amp;#x000A;}&amp;#x000A;&amp;#x000A;$begin=0;&amp;#x000A;$end=1;&amp;#x000A;&amp;#x000A;while ($end&amp;lt;count($odd)) {&amp;#x000A;&amp;#x000A;    $write='';&amp;#x000A;    $result=0;&amp;#x000A;&amp;#x000A;    for ($i=$begin;$i&amp;lt;$end;$i++) {&amp;#x000A;&amp;#x000A;        $result=$result+$odd[$i];&amp;#x000A;&amp;#x000A;        $write.=$odd[$i];&amp;#x000A;&amp;#x000A;        if ($i==($end-1)) {&amp;#x000A;            $write.='=';&amp;#x000A;        } else {&amp;#x000A;            $write.='+';&amp;#x000A;        }&amp;#x000A;&amp;#x000A;    }&amp;#x000A;&amp;#x000A;    $write.=$result;&amp;#x000A;&amp;#x000A;    echo '&amp;lt;h3&amp;gt;' . $write;&amp;#x000A;&amp;#x000A;    $square=sqrt($result);&amp;#x000A;&amp;#x000A;    if ($square==$end) {&amp;#x000A;        $question=&quot;Yes&quot;;&amp;#x000A;    } else {&amp;#x000A;        $question=&quot;No&quot;;&amp;#x000A;    }&amp;#x000A;&amp;#x000A;    echo ' numbers=' . $end . ' sqrt(' . $result . ')=' . $square . ' Really? ' . $question . '&amp;lt;/h3&amp;gt;';&amp;#x000A;&amp;#x000A;    $end++;&amp;#x000A;&amp;#x000A;}&amp;#x000A;&amp;#x000A;?&amp;gt;&amp;#x000A;&lt;/code&gt;&lt;/pre&gt;
    </content>
    <published>2012-06-06T00:00:00+00:00</published>
    <updated>2012-06-06T00:00:00+00:00</updated>
    <category term='development'></category>
  </entry>
</feed>
