Pierre Palatin random posts.

Recent posts

Jan 1, 2008
Automatic detection of mails moved from/to the spam folder

A script allowing to just move mail between folders in IMap to train antispam.

This script work but is unmaintened. There’s an issue which can tend to damage the automatic learning. It should not drop your mails, but that might generate bad classification or nuke your dspam learning base.

Jan 1, 2008
Redirecting a port to another one with iptables, including local packets.

For some reason, I have a smtp server running completely as user and which cannot open port 25; it listens to port 2225 instead. So, I want to redirect port 25 to port 2225, using iptables.

Apr 26, 2006
Repairing RRD files

Here is a python script to repair rrd databases where some data had been in the future.

Jan 1, 2006
Automatically creating a disk image with partitions and bootloader.

I’m often playing with tools to manipulate full system images for virtual machines and so I often need to create disk images. The attached script allows to create a disk image of an arbitrary size with partitions and a working grub bootloader. This kind of script can be a bit dangerous, so I put it there just as an example, be careful. It is using qemu-img to create the disk image (which can be easily replaced by dd), sfdisk to create the partitions, and grub to install a boot loader.

Jan 1, 2006
Booting on a virtio disk with qemu Recent versions of Qemu, like version 0.10.1, are able to use virtio disks if your guest kernel support it. While kvm has an option boot=on for -drive descriptions, qemu doesn’t have it yet, and so is not able to boot from virtio disks by default.…
Jan 1, 2006
How to boot a debian netinst over serial in a qemu without display The debian netinst is able to work over serial but if a graphic card is detected, the bootloader won’t be sent over serial, which make appending options to display over serial a bit tricky.…
Jan 1, 2006
Perl virtual environment

While Python as the extremely useful virtualenv tool, I haven’t found anything similar for Perl. What I want is quite simple: being able to test random perl tools. They usually depend on a various set of libraries, some of them either too old on my system or not even present. Most of the time, I just want to test the tool, so installing random perl modules system-wide is not an option. Moreover, I really don’t like having to install something system-wide which is not coming as a package for my distribution. The solution is to have a virtual environment where I can install all the libraries I want, somewhere in my user directory. This has the advantage too of allowing to use a different version of a library for different perl tools.

Jan 1, 2006
Python project from scratch with distutils and friends

Python has several more or less standard tools to properly create and/or distribute python code. This shows a practical starting point.

A few tools exists:

  • virtualenv allows to create a self contained python environment, with any dependencies you want, without impacting the system instance. Extremely useful for developing, testing or even running any python code.
  • distutils provide the basics of python package management. It’s now quite old, so to do something you must use some of the extensions. Distutils2 is around the corner.
  • setuptools are extensions to distutils; it’s one of the most wide spread library for python packages currently. It includes easy_install which allows to easily install python packages.
  • distribute is a fork of setuptools. It evolves regularly (which is not the case of setuptools) and is maintained by the creators of distutils2.
  • PIP is a replacement for easy_install.

We’re going to use Distribute and PIP here it looks like they become the standard.

Jan 1, 2006
Qemu in Screen

This python script allows you to start a Qemu in a screen with separated screen windows for qemu monitor and for serial port.

Jan 1, 2006
Simple integration of Gallery2 in Dotclear2

This patch is probably completely deprecated. The attached patch enable an integration of Gallery2 images on a Dotclear 2 blog.