Enable IPv6 routing on Linux
To enable IPv6 routing on your Linux box you can use the following command:
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
If you want to keep IPv6 routing enabled permanently, edit /etc/sysctl.conf and add the following line:
net.ipv6.conf.all.forwarding=1
Remember that IPv6 filtering rules are controlled via ip6tables.
Solving (or improving) Macbook keyboard layout problems on Linux
Apple laptops have a slightly different keyboard layout. Obviously the keyboard works fine on Mac OSX but has some minor problems on Linux and Windows. In my case I have a Spanish layout and the Alt key doesn’t work by default. Hence I am unable to type some characters (@ # |). If you come across the same problem, one solution is to change the keyboard layout from Spanish to US international. This way those specials characters are accessible by pressing the Shift key. Besides programming with the US layout is faster (e.g. / and ; just need one keystroke).
To change the keyboard layout in Centos type:
# system-config-keyboard --text
… and choose US layout.
Wordpress Complete Backup Solution
Backing up your data is very recommendable (if you don’t do it start now!) and can save you a few headaches. This posts explains how to backup your Wordpress installation. You need to take care of 2 things:
- The Wordpress database
- The Wordpress files (plugins, themes, etc.).
For backing up the database I recommend the wp-db-backup plugin, which can be configured to send a daily backup of your database to your mail account.
If for any reason you lose your Wordpress data, you can retrieve the backup from your mail and restore it with the following command:
mysql --default_character_set=utf8 -h hostname -u username -p database < mybackup.sql
You can obtain the host, username and database name from wp-config.php. The encoding is important. If you don’t specify it your restored posts can look pretty messy.
Following the previous steps your posts and configurations are protected and chances of losing them are very low. The next step is to backup the Wordpress files (plugins, themes, config files, etc.). To perform this task I recommend rsync. This excellent tool is included on Unix-based systems (Linux, Mac, etc.). There are binaries for Windows also. Rsync performs folder synchronization (bot remotely and locally). One of its main advantages is that it does incremental backups (i.e. it only transfers the changed files). I use rsync to synchronize my remote Wordpress installation with a local folder. This way, every time something changes in the server, these changes are transferred to my local computer. The rsync syntax is as follows:
rsync -avvb --delete --backup-dir=/Users/jorge/rsync/backup_$(date +%y%m%d%H%M) username@somebox.bluehost.com:/home4/username/public_html /Users/username/bluehostbackup/
It’s a good idea to schedule a cron job to run that command daily (or hourly if you change things quite often).
And that’s it. Making use of wp-db-backup and rsync you get an easy and fast backup solution that can save you a lot of trouble.
Conditional compilation in Latex
The ifthen package allows conditional blocks on Latex documents. This is very useful if you want to include or exclude some parts of the text. To use the package add the following to the document preamble:
\usepackage{ifthen} \newboolean{DEBUG} \setboolean{DEBUG}{false}
Then you can use \ifthenelse commands within the document to include/exclude parts of text. In this example, as the DEBUG variable is set to false, the debug text won’t appear in the final document. If we switch its value to true, the debug text will appear again.
\ifthenelse {\boolean{DEBUG}} {This is some debug text} {This is the other text}
How does Opera Unite’s File Sharing Service work?
Opera has introduced a new feature called Opera Unite in its browser. Opera Unite allows service sharing from the web browser. These services include File Sharing, Fridge, Media Player, Photo Sharing, The Lounge and Web Server.

Since it looked promising, I decided to try it out. Setting up the File Sharing service just took a few minutes and everything worked fine. Which made me think … how does it really work? I’m behind a NAT connection and haven’t configured my router which, by the way, doesn’t support UPnP. Perhaps magic? … don’t think so.
To test how it worked I started a file download and fired up Wireshark to examine the packets. They were coming from an Opera server. This happened on the client’s side. On the server’s side Opera had opened a connection to another Opera’s server. So it seems that the service works the same way as a Reverse SSH Tunnel:
- The browser establishes a connection to an Opera server (tunnel A).
- When the clients access the service they’re really establishing a connection to an Opera Server (tunnel B).
- Tunnel A and Tunnel B get connected and the data flows.
The question that comes up is … Does the service always operate this way? Is the connection direct when the user is not behind a NAT or supports automatic port forwarding?
In general the service looks good to me, being its main advantage the ease of use. On the other hand, the information exchange is not strictly between the server and the client (shared files go through the Opera’s network), which can be a deterrent for some users.
Schedule commands to run later on Linux and Mac
For scheduling periodical tasks you have Cron. But if you just want to schedule a command to run later you can use at.
# at 12:00 # at> echo “Scheduled phrase”|mail addr@provider.com # at> (type control+d) job 6 scheduled at 2009-06-16 12:00
You can see the scheduled tasks with atq and remove them with atrm
# atq 6 2009-06-16 12:00 a root # atrm 6 (where 6 is the task id)
Mac4lin brings the beauty of the Mac to the Linux desktop
Seen on Lifehacker. Two years ago I bought a Macbook and from that moment on, I’m pretty much in love with the Mac look & feel. Its ease of use and integration are impressive. Mac4lin brings these fancy features to the Linux Desktop. It includes skins, wallpapers and interface refinements that resemble the Mac experience. It definitely worths a try!

Recover the root password on Linux
There are many different ways to recover a lost root password on Linux systems. These are two of them:
When the Grub screen appears, press ‘e’ and append ‘1′ to the line. The system will boot in single user mode. When you are presented the root prompt type the password command to change the password.
Another option is to mount the root filesystem and do a chroot:
# mkdir /mnt/system # mount /dev/sda1 /mnt/system # chroot /mnt/system # passwd
In the first case you can prevent password recovery assigning a password to Grub.
# /sbin/grub-md5-crypt
This command returns a MD5 hash of the entered password.
Next, edit the Grub configuration file /boot/grub/grub.conf and add the following line (replace ‘password-hash’ with the grub-md5-crypt command output):
password --md5 password-hash
Now Grub doesn’t allow direct access to the edit or command menus. You have to press ‘p’ and enter the password.
Get Jorge Martinez de Salinas delivered by email