Twig PHP templating system

Twig is a popular templating system, from the creators of the Symphony framework. Here I describe a minimal startup guide for those preferring a manual installation (i.e. no composer).

require_once 'lib/Twig/Autoloader.php';  
$loader = new Twig_Loader_Filesystem('templates/');  
$twig = new Twig_Environment(     
   array( 'cache' => 'cache/')

$twig = new Twig_Environment($loader);

echo $twig->render('index.template', 
   array('name' => 'Andrea', 'surname' => 'Telatin')

where the index.template file is

Hello {{ name }} {{ surname }}!


some HTML5 learning resources

HTML5 for Webdesigners (PDF format)

Dive into HTML5 (online)

Course specification (PDF)

Cheat sheet (PDF)

Google reCaptha: we’re all human beings

To implement the simple (for the user) captcha provided by Google one have to get an API key from Google to use it. Then the mechanism is quite simple: the Captcha code is an input of the form that will submit a value. The program receiving the form data will validate the captcha with a request to Google.

I made a single page PHP example just in case.


Bitmap to vector: tracing in Linux

Inkscape gives the possibility to trace a bitmap object to a vector one from the menu Path > Trace Bitmap item, or Shift+Alt+B (see this page).

More interesting is the possibility to to the same from the shell, without the need of an interactive program. I loved potrace for this, available from the repository. Its input are BMP images, so imagemagik will become handy:

convert input.png input.bmp
potrace -b pdf -o output.pdf input.bmp
potrace -b svg -o output.svg input.bmp

CMS with Plain Text files

I stumbled upon Grav, a CMS based on flat files that will turn mark-down text into nice websites.

What I like about it, in particular, is the fact that can be used to turn your pipelines output into an easily browseable website.

Evernote from command line

As mentioned before, you get a productivity boost when you link your mobile life with the terminal, with a program you can pipe, parse, grep…

Geeknote ( is a command line interface for your Ever Note account.

Installation is as easy as:
git clone git://
cd geeknote
sudo python install
geeknote login

The latter will ask you to provide login credentials (press enter when asked for Two-Factor auth code, if you didn’t enable it) from the shell. While this is a good thing, unfortunately the authorization is not permanent, but “per session”.

Google Calendar from command line

The connection between my mobile phone and the rest of my IT life (i.e.  the Linux terminal 🙂 ) will likely get a little bit harder, at least this is what if fear.

Thankfully there are awesome packages that still seems robust and insanely useful.

Gcalcli (, a Python script to manage your Google Calendar via APIs is one of them.

Screenshot from 2015-11-26 10:18:41

Instant view of your week with the “gcalcli calw command

The program is written in Python 2.7, and can be installed by:

pip install gcalcli

And in most systems you’re done (I used some Mint from 2013). When you first invoke it will launch your browser for the OAuth, so it’s handy to have one at least the first time!