Remove password from PDF from the command line

I prefer to use qpdf as it’s easy to install via brew also in macOS, while pdftk isn’t.

qpdf --password=$PASS --decrypt $INPUT_PDF clear_$INPUT_PDF

Original article: link

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';  
Twig_Autoloader::register();  
$loader = new Twig_Loader_Filesystem('templates/');  
$twig = new Twig_Environment(     
   $loader,     
   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 }}!

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

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 (www.geeknote.me) is a command line interface for your Ever Note account.

Installation is as easy as:
git clone git://github.com/VitaliyRodnenko/geeknote.git
cd geeknote
sudo python setup.py 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”.