cat | more

Here is a video of the cat in action:

We invested dozens of euros in sophisticated cat toys and catnip and her favourites are the small mouse-shaped furball for .9 euros and a shoelace…

Debian VM templates

This post is mostly a post-it for myself :)

I use kvm with virt-manager to manage a couple of VMs to develop stuff and test ideas.

Most of the time I install a Debian stable or testing distribution in a small VM and take it from there.
There’s always a little customizing after that like installing vim/a MySQL server/etc.

As installing Debian is time-consuming and the setup of the machines is mostly the same I wanted to create a template to simply clone and be done.

Steps to reproduce:
* fire up VM
* install clean Debian (I chose web + ssh-server, no desktop)
* install additional software (I added: vim, mysql-server, libnss-mdns, uuid)
* apt-get clean
* ssh-copy-id your ssh keys if you want to
* remove all entries from /etc/udev/rules.d/70-persistent-net.rules
* if you don’t want your VMs to have persistent network interfaces at all, delete /lib/udev/rules.d/75-persistent-net-generator.rules, though it might come back on udev updates
* save this script as /root/rename-vm.sh and chmod +x it (Adjust keyword and name generation to your liking)

#!/bin/bash
set -e
set -u
keyword="template"
name="debian-${1:-$(uuid)}"
if [ -n "$(grep $keyword /etc/hostname)" ]; then
echo $name | tr " " "-" > /etc/hostname
reboot
fi

You should now be able to clone the machine, boot it, log in as root ./rename-vm.sh “new name”.

Assuming you have libnss-mdns installed and a proper networking setup for your VMs it should then be available as debian-new-name.local.

Make sure to update the template from time to time. You might need to remove the persistent-net rules again.

Caveats: All the clones have the same ssh host key and user passwords.

About that set -e/set -u stuff, I’ve come to put that at the top of all my shell scripts, see: Writing Robust Bash Shell Scripts

Green Beret

My cat has one, does yours?

The Phing Thing

Try this in phing:

<?xml version="1.0"?>
<project name="tartest" default="tartest" basedir=".">
<target name="tartest">
<mkdir dir="tartest"/>
<touch file="tartest/test.txt"/>
<touch file="tartest/test.__txt"/>
<touch file="tartest/test__.txt"/>
<touch file="tartest/test_._txt"/>
<tar destfile="tartest.tar" basedir="tartest" />
</target>
</project>


I would have expected it to actually DO pack the whole directory.

This works:

...
<tar destfile="tartest.tar">
<fileset dir="tartest" defaultexcludes="false">
<include name="**/**" />
</fileset>
</tar>
...

It’s the same for zip archives.

don’t unclutter dwm

It doesn’t like it. Unclutter is a little program which hides your mouse pointer if it idles.

chaos!

Day 0: Cash registers closed, WLAN working.

The estimates as to when the cash registers would open developed as follows:

12 hours -> rand(6,12) hours -> 22 o’ clock.

I got my ticket despite the troubles. Good riddance as they were sold out the next morning.
Day 1: Topics to look up: GSM security, dnssec, OpenMoko, sleephacking, arduinos, MakerBots
Day 2: Microcontrollers!

vimrc

I had uploaded my favorite vimrc somewhere, but I forgot where…

This is mostly for my reference and not the final product: vimrc

Not a NaN...

I tried to copy a mysql database with several gigabytes of data and suddenly the receiving end chokes on a ‘nan’.

Nani?

Well apparently earlier versions of mysql supported ‘nan’ and ‘inf’ as valid float values but newer versions don’t as they abide by the SQL standard which states:

‘Thou shalt not NaN’

And thus it’s in the data but it won’t go into the new database.
Suckage ensues…

So how do you find all those NaNs to make them something useful again?

Magic!

SELECT * FROM `table` WHERE `value` > 3e+40

If i understood it correctly 3e+40 is larger than maxFloat but NaN wins the comparison. The same can be used to replace all those values with something valid.

Yay!
Go nuts.

Just chilli-ing...

We recently had breakfast at a little place called ‘Caramel‘ and their table-decoration is awesome:

caramelchili

Chili plants!

Livin' in a bad block...

If you ever need to copy a directory structure which contains files which sit on bad blocks on Windows, try XCOPY /C.

I added a little /E /Y and off it went.