Copy Whole Disk over Network

rsync -axv -e ssh root@source:/ /mnt/root

Disk Encryption Using LUKS

Load device mapper, encrypt partition, optionally add second passphrase, open encrypted partition and format it using ReiserFS:
moprobe dm-mod
cryptsetup -c aes-xts-plain -y -s 512 luksFormat /dev/sda1
cryptsetup luksAddKey /dev/sda1
cryptsetup luksOpen /dev/sda1 root
mkfs.reiserfs -l ROOT /dev/mapper/root

PostgreSQL Timestamp and Unix Time Conversions

PostgreSQL timestamp to Unix time:
postgres=# select extract(epoch from timestamp with time zone '2011-01-02 03:04:05+06');
 date_part  
------------
 1293915845
(1 row)
Unix time to PostgreSQL timestamp:
postgres=# select to_timestamp(1293915845);
      to_timestamp      
------------------------
 2011-01-01 22:04:05+01
(1 row)

Capture and Replay Network Traffic

Example of capturing and replaying captured syslog traffic.

Capture:
tcpdump -v -s 0 -w syslog.dump -nn udp dst port 514
Rewrite:
tcprewrite --fixcsum \
           --enet-dmac=00:11:22:33:44:55 \
           --dstipmap=0.0.0.0/0:1.2.3.4/32 \
           --infile=syslog.dump \
           --outfile=syslog.redump
Replay:
tcpreplay -i eth0 --topspeed syslog.redump
tcpreplay -i eth0 --mbps=5.0 syslog.redump

POE::Component::Client::DNS

Examples of resolving a "large" number of domains in parallel using asynchronous DNS calls.

Version 3 API

Version 2 API