<p>During the final weeks of my exam session I started reading a bit about python 3 using an excellent book: <ahref="http://www.diveintopython.net/">Dive into Python</a>.
When I noted that python uses the <ahref="https://en.wikipedia.org/wiki/Mersenne_Twister">Mersenne Twister PRNG</a> as well I decided to write another version of my <ahref="http://francescomecca.eu/index.php/archives/207">Buridan's donkey program</a>.</p>
<p>This script works in a different way than the one in c++.
Rather than shuffling a list made by the entries in the arguments, it pops randomly one entry from the list till the list is empty.</p>
<p>Not satisfied enough, I wrote also a telegram bot using the <ahref="https://github.com/eternnoir/pyTelegramBotAPI">telebot library</a> that works as the script above but inside the telegram app.
The bot can be added to your contact list by simply searching for <ahref="http://telegram.me/duridan_donkey_bot">@duridan_donkey_bot</a> (yes, a typo!)</p>
<p>All the code is opensource and can be found on my github page.</p>
<p>Until one week ago my blog was hosted at my house, on a raspberrypi with debian + wordpress. I was not satisfied by my setup because given the minimal size of my blog and the really scarce content I post every now and then, a full LLMP stack was overblown.
I decided to change distribution (my server now runs <ahref="http://www.voidlinux.eu/">Void</a>) and to migrate to a static blog without CMS nor PHP.</p>
<h1id="welcome-to-jekyll-and-hyde">Welcome to Jekyll and Hyde</h1>
<p>The process of migration was rather painless.
First of all I installed ruby on my desktop computer, then via ruby gems I installed jekyll:</p>
<p><code>gem install jekyll</code></p>
<p><code>gem install jekyll-gist</code></p>
<p><code>gem install jekyll-paginate</code></p>
<p>I used a <ahref="https://wordpress.org/plugins/jekyll-exporter/">wordpress plugin</a> to copy all my old posts.
Then I cloned from <ahref="https://github.com/poole/hyde">git</a> the Hyde theme which you can see a demo <ahref="http://hyde.getpoole.com/">here</a> and corrected a pair of warning that jekyll printed on my terminal. Actually the <ahref="http://jekyllrb.com/docs">jekyll docs</a> are quite complete and covered all the errors that I encountered.</p>
<p>Jekyll structure is quite simple to understand: in the folder _post/ there are your post in markdown format (remember to delete the examples in that folder);
in the root the are some files that should be modified: the about.md file, the 404 page and index.html that is the frontpage of the blog;
finally _config.yml contains the general configuration for the website and should be adjusted to your own likings.
When Jekyll builds a website it parses all the markdown files and stores them in _site folder. Jekyll uses the html files in _layouts and _includes to render the markdown files.A</p>
<p>I added a simple <ahref="http://francescomecca.eu/archive/">archive page</a> following the little piece of code in <ahref="http://joshualande.com/jekyll-github-pages-poole/">this page</a></p>
<p>so I proceed to remove it because is not needed for my blog.
Finally I put a link to the archive, my github page and the atom feed on the sidebar by simple adding a href on _includes/sidebar.html.</p>
<p>I did not proceed with further modifications but there are tons of possibilities with jekyll. I think that the main advantages are the fact that you don't have to manage html code when writing a new post and that everything can be done via cli.</p>
The Buridan’s donkey is an illustration of a paradox regarding the philosophy of moral determinism and free will.
</p>
<pstyle="text-align: left;">
The paradox shows an hypothetical situation in which a donkey searching for food is caught in the middle of two equally appealing stacks of hay located at the same distance from the donkey. Because the donkey has no real reason to choose one over the other he dies of starvation.
</p>
<p><ahref="https://en.wikipedia.org/wiki/Buridan's_ass"><imgclass="aligncenter size-full wp-image-209"src="http://francescomecca.eu/wp-content/uploads/2015/09/Deliberations_of_Congress.jpg"alt="Deliberations_of_Congress"width="431"height="425"srcset="http://francescomecca.eu/wp-content/uploads/2015/09/Deliberations_of_Congress-300x296.jpg 300w, http://francescomecca.eu/wp-content/uploads/2015/09/Deliberations_of_Congress.jpg 431w"sizes="(max-width: 431px) 100vw, 431px"/></a>I have decided to write a cli program that chooses for me when I can’t make up my mind.</p>
<p>The program is written in C++ and when invoked along with two or more arguments it puts them in a vector and then changes the order randomly.</p>
<p>I have used the <ahref="http://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine"target="_blank">Mersenne Twister PRNG</a> just to give it a try.</p>
<pstyle="text-align: left;">
One of the challenges was to read from stdin instead of arguments when the program is piped after another program in the shell:
<p>So I have used poll() that checks for a specified amount of time if the selected device (/dev/stdin in my case) can perform I/O operations; in my code:</p>
<p>I selected the POLLIN as event so poll() only checks if there is data to read, 1 as the number of items in the fds array, 0 milliseconds of timeout because when the program is invoked /dev/stdin may already contain input.</p>
<p>You are free to reuse this little piece of code as you wish.</p>
<p>EDIT: 02-04-2016
The original idea for the Buridan's donkey came from my mentor <ahref="https://twitter.com/bassosimone">Simone Basso</a> who wrote the original one in haskell.</p>
<p>In this post I wish to explain a bit about Perl related ebuilds in Gentoo and how to update from perl-core to virtual/perl without conflicts.</p>
<p>First of all the core distribution of Perl is included in <ahref="https://packages.gentoo.org/package/dev-lang/perl">dev-lang/Perl</a> along with <ahref="http://perldoc.perl.org/index-modules-A.html">modules</a>.</p>
<p>The <ahref="https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/perl-core/">perl-core category</a> in portage contains ebuilds for perl modules, some of which are included in the core perl distibution. The perl-core ebuilds overrides the perl-core modules such that you can update them without recompiling dev-lang/Perl.</p>
<p>Each perl-core module has a corrensponding virtual/perl-* package. The virtual category is used by portage when emerging to take into account that a module can be either provided by dev-lang/perl package or found in perl-core category.</p>
<p>So, what to do in case of blocks when upgrading your Gentoo machine?</p>
<p>Perl-cleaner is a package provided to get rid of these blocks and to migrate from perl-core to virtual/perl-*.</p>
<p>Dura 56 secondi il video di Vester Lee Flanagan che testimonia l’omicidio in prima persona di due giornalisti in Virginia durante un live broadcast televisivo. Durante l’inseguimento nel quale si e` tolto la vita Flanagan ha caricato su Twitter e Facebook il video dell’uccisione in prima persona.</p>
<p>Twitter e Facebook hanno tempestivamente censurato il video e rimosso l’account dell’omicida ed alcune emittenti televisive (come SkyTg24) hanno scelto allo stesso modo di non pubblicare il video in diretta.</p>
<h3id="to-publish-or-not-to-publish">To publish or not to publish?</h3>
<p>E` quindi una decisione giusta quella di non pubblicare il video?</p>
<p><ahref="https://stevebuttry.wordpress.com/2015/08/26/media-should-avoid-indulging-attention-seeking-killers/"target="_blank">Steve Buttry sul suo blog</a> si esprime in questo modo:</p>
<blockquote>
<p>1) Someone who attacks during a live telecast is seeking attention. Obviously you need to report the attack, but I would not broadcast the attack or make it available online.</p>
<p>[…]</p>
<p>4) I see no ethical justification for publishing videos shot by the killer. That is the ultimate in attention-seeking behavior.</p>
<p>5) You can report the mental health issues, gun access issues and other issues that a story presents without publicizing or profiling the killer.</p>
<p>6) My focus would be on the people who were killed or injured. They warrant media attention, not the person who was seeking it.</p>
</blockquote>
<p>1)Una persona che attacca durante una trasmissione in diretta e` alla ricerca di attenzione. Naturalmente si deve rendere noto l’atto, ma io non lo trasmetterei ne lo pubblicherei online.</p>
<p>[…]</p>
<p>4) Non vedo giustificazioni etiche per pubblicare il video: e` l’esempio piu` eclatante di ricerca di attenzioni.</p>
<p>5) Puoi discutere sui problemi mentali, la questione relativa al facile accesso alle armi e tutti gli altri problemi di questa storia senza mostrare o pubblicizzare il killer.</p>
<p>6) Io mi concentrerei sulle persone ferite o uccise. Loro meritano l’attenzione dei media, non la persona che la cercava.</p>
<h3id="famoso-in-un-istante">Famoso in un istante</h3>
<p>E` ovvio che Flanagan stesse cercando i suoi 15 minuti di fama con <ahref="http://www.theguardian.com/us-news/2015/aug/27/virginia-shooting-in-an-instant-vester-flanagan-broadcast-death-to-the-world"target="_blank">questo atto</a>, ma a mio parere non ci sarebbe riuscito se non sfruttando nuovi strumenti quali lo smartphone e i social network. Molto difficilmente sarebbe riuscito 20 anni fa utilizzando i media tradizionali a filmarsi in prima persona in una situazione del genere e a rendere cosi` tante persone testimoni del suo gesto.</p>
<p>Per questo non mi trovo d’accordo con Steve Buttry che afferma che il video non andrebbe reso disponibile online. i nuovi media hanno un ruolo diverso nella condivisione dei contenuti e soprattutto nel mantenimento della memoria storica. Un video del genere non aggiunge alcun valore investigativo o giornalistico al caso ma puo` ritenersi utile per analisi differenti, in primis psicologiche, ed ha sicuramente un valore storico (da quanto conosco e` il primo video in prima persona di un omicidio con queste dinamiche).</p>
<h3id="lo-specchio-nero">Lo specchio nero</h3>
<p>Chi come me e` un grande fan della serie TV <ahref="https://en.wikipedia.org/wiki/Black_Mirror_%28TV_series%29"target="_blank">Black Mirror</a> avra` sicuramente ricordato il primo episodio della serie: National Anthem.</p>
<p>Questo episodio e` un’analisi sottile e dettagliata della natura umana, che di fronte ad eventi che suscitano un cosi` grande clamore sospendono ogni giudizio morale e dimenticano il motivo per cui si trovano a guardare cio` che hanno di fronte.</p>
<p>Allo stesso modo trovo miserevole poter assistere a giornalisti ed emittenti televisive che per attirare spettatori nelle proprie reti mostrano il video integrale.</p>
<p>Come in National Anthem chi ha perpetrato il crimine non ci ha costretto ad essere complici del suo gesto.</p>
<!--<span class="site-footer-owner"><a href="http://francescomecca.eu">Caught in the Net</a> is maintained by <a href="contattami">Francesco Mecca</a>.</span>-->