Augusto Destrero Articles


Drop all tables in a database

Sometimes it can be useful to completely drop all tables in a database, for example to reset a DB to a previous version from a backup. After checking that you are doing this on the right database and that you know what you are doing, you can do this: SET …

Batch resize JPEG images with maximum resolution and size

Just discovered a quick and dirty way to resize a bunch of jpeg files to a maximum resolution and size: mogrify -resize 1024x1024 -strip -define jpeg:extent=200kb *.jpg This command will resize all jpg images in the current directory with a maximum resolution of 1024px for each side (maintaining …


  • Wed 18 May 2016
  • web

How to migrate your existing Django project to Heroku

Recently I had some fun with Heroku, the well known PaaS provider. I had a small personal Django project I use for invoicing that I ran locally with ./manage.py runserver when needed. That was a perfect candidate for the Heroku free plan because I need to access the app …

Configure SFTP access to your Ubuntu server through SSH

Sometimes you have to give your users a way to manage files on your server. A typical scenario is a web server where your users manage their websites by themselves. The classical approach in this scenario was to use FTP to give file management capabilities to your users, but it …



Why I love Python – Expressiveness

Here is one of those little things that make me love Python: d = {'a': (1,2), 'b': (3,4)} for k, (a, b) in d.items(): print k, a, b Prints: a 1 2 b 3 4 How cool is that? 😉

How to turn your Raspberry PI in a Google Cloud Print device

Google Cloud Print (GCP) is a quite useful Google service, allowing you to print in a GCP compliant printer from everywhere and from every device of yours, be it a desktop, a tablet or a smartphone. There are quote a lot of printers out there supporting GCP out of the …

How to reset mysql root password on Ubuntu 12.04

Fast and easy! $ sudo stop mysql $ sudo -umysql mysqld_safe --skip-grant-tables & $ mysql mysql> UPDATE mysql.user SET Password=PASSWORD('newpassword') WHERE User='root'; mysql> FLUSH PRIVILEGES; $ sudo kill `cat /var/run/mysqld/mysqld.pid` $ sudo start mysql Enjoy your new mysql root password!