Dymo is a leading company for label printing. Altought several things can be done using their DYMO Label v.8 Software, I found that there was no way to set a specific date in a label layout so that every time I need to print a label I have the current date plus 30 days. I read the manual and I found that to do it we have to use a variable field but this is something that has to be handled using an external program.

So I wrote a little python tool that runs on Windows 7 and that does exactly what I need. Make sure to install pywin32 since we are going to use COM apis.

This is my example label (my.label) and the related Python code:

As you can see I have two fields in the XML with IsVariable set to True and I have assigned to them the name TEXT1 and TEXT2. Now, all the logic happens between line 30 and line 41 of the Python script.

I initialize the Dispatch for the printer, configure the label I want to use (mylabel) and then I select the printer [lines 30-34].

Then I apply my rules to the variables TEXT1 and TEXT2 [lines 36-37].

And finally I launch the print job [lines 39-41].

That's all! With only few lines of Python code we are able to print a label using our Dymo LabelWriter 450 Turbo printer.

Note: the full code is available on GitHub including the scripts to build a self-contained executable.

Mega is a wonderful and secure online cloud service that offers 50GB of free storage. So I thought that it would be great using it as additional backup service for my Linux servers. Fortunately there is a good application library and tools to access Mega storage from Linux command line. This tools are called megatools and it is released under GPLv2 license.

In this post I will show you how to compile, install and configure a full backup system for your server using Mega and MegaTools.

First of all register an account with Mega at http://mega.co.nz then follow these instructions to compile and install megatools.

NOTE: in case you want to allow ICMP (Ping) traffic from a specific remote hosts you need to add a rule similar to the following where xxx.xxx.xxx.xxx is the remote IP address, before the Ping(DROP) rule:

Ping(ACCEPT) net:xxx.xxx.xxx.xxx $FW

Now edit /etc/default/shorewall and change startup=0 to startup=1 You are now ready to start the firewall:

/etc/init.d/shorewall start

Setup Postfix

Stop postfix server:

/etc/init.d/postfix stop

Edit /etc/mailname and set your server domain name, for example:

server1.mycompany.com

Then, in order to monitor mail traffic coming from PHP you need to edit /etc/php5/apache2/php.ini. Go to [mail function] section and set the following two options:

Given I did it dozens of times and everytime I have rewritten the code form scratch, I decided to write a simple script to backup all MySQL databases separately in order to avoid to always reinvent the wheel.

The following script must be configured with:

the MySQL root user.

the password of MySQL root user.

the email address to receive the notifications in case of failures.

the destination folder of the backups.

the number of copies to keep before overwriting the old backup.

NOTE: given the MySQL root password is in clear is important to limit the access to the script:

chown root.root mysql_backup.sh
chmod 660 mysql_backup.sh

Then, to set a cronjob to do it automatically every day, open /etc/crontab and add the following line at the bottom: