From now on all my posts will be published on Twitter. So you can follow me and never miss any updates

Comments (0)

2013-10-08 13:50:55

Find files by date

An easy way to search for files within a daterange:

$ touch --date "1970-01-01" /tmp/start
$ touch --date "2038-01-19" /tmp/end
$ find /location -newer /tmp/start -not -newer /tmp/end

Comments (0)

2013-10-01 12:28:25

Multiple SSH Keys

Sometimes I need to generate passwordless authentication via ssh. So here is a little tutorial:

# On local machine:
$ ssh-keygen -t rsa -f ~/.ssh/id_rsa_remotemachine
$ scp ~/.ssh/ user@remotemachine:.ssh/
$ echo Host machine >> ~/.ssh/config
$ echo IdentityFile ~/.ssh/id_rsa_remotemachine >> ~/.ssh/config
$ echo User user >> ~/.ssh/config

# On remote machine
$ cat ~/.ssh/ >> ~/.ssh/authorized_keys

Now login should work with "ssh remotemachine".

Comments (0)

2013-10-01 11:39:05


There was a problem with my downloads. Fixed it and now it should work again

Comments (0)

2013-09-29 18:32:43

Calculate with zsh

An easy calculator for the z-shell. Insert into ~/.zshenv:

zcalc () { print $(( ans = ${1:-ans} )) }

Some examples:

% zcalc 5/2 # Division with integer
% zcalc 5.0/2 # Division with floating point
% zcalc "5*2"
% zcalc 5%2 # Modulo Operations

Comments (0)

2013-08-15 15:05:47


I've reimplemented the comments section. The CAPTCHA must now be entered together with the comment and you will no more redirected to another page.

Comments (0)

2013-06-13 14:01:28

systemd, netctl, ifplugd and bridge

Today I attended to automatic connection on wireless and wired interface. The wireless interface was no problem on Arch Linux. Just install wpa_actiond and enable netctl-auto@.service. More headache on the bridged interface:

ifplugd only recognizes interfaces listed in /proc/net/dev, where br0 isn't listed until it is started by netctl. So after a bit research I found /etc/ifplugd/netctl.action which is called by ifplugd in conjunction with netctl. A typical call is "/etc/ifplugd/netctl.action eth0 up". But eth0 isn't in one of my netctl profiles as interface and br0 is no device in which a cable is ever plugged in..

So I've had to options: 1. Giving up my bridge, 2. Adjusting netctl.action. Giving up my bridge would lead to unusable VMs, ergo only one option left:

Replace the test against the interface with the bridge interface and the test against the connection with "bridge". This will always use your bridge profile and nothing else anymore. In other words:

[[ "$Interface" == "$1" && "$Connection" == "ethernet" ]] || continue
[[ "$Interface" == "br0" && "$Connection" == "bridge" ]] || continue

After changing netctl.action you just need to enable netctl-ifplugd@eth0.service and ifplugd@eth0.service (replace eth0 with your interface).

Attention: I use only one bridge profile with a static IP. Whenever I need a dynamic IP I use my WiFi. It is possible that this solution my not work, if you use other profiles as well...

Comments (0)

2013-04-18 21:53:54

Convert Xen xva to vhd

Sometimes I need to convert a xen xva image to a vhd image for VirtualBox. So here is a quick howto:

qemu-img convert -O raw input_file.xva output.raw
VBoxManage convertfromraw input_file.raw output_file.vhd --format VHD

Comments (0)

2013-04-03 12:01:31

find | xargs

Today cron doesn't want to regexp my "cp [a-Z]* ...". Even if i set SHELL=/bin/bash in the crontab it got the error "cp: cannont stat [a-Z]*: No such file or directory". Manually on the shell there is no problem with regexp (it's locales fault; cron uses the POSIX locale and here I should use [a-zA-Z] as regexp). So I tried find in combination with xargs:

find /dir -print0 -type f | xargs cp -t /target/dir

The commandline switch -t makes it easier to use xargs with cp and even mv.

Comments (0)

2013-03-26 09:24:53

udev rules

Looks like Linux 3.8 has a stupid bug. The e1000e driver for Intel NICs does not work correctly (ref. here). In short: The powersaving prevents the NIC from comming up correctly. So I wrote a udev rule to always power on my NIC. In fact there are only a little chances I won't need it:

SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{subsystem_device}=="0x21f3", ATTR{device}=="0x1502" ATTR{power/control}="on"

Compare vendor, subsystem_device and device with your own configuration. Either with udevadm(8) or with udevinfo(8).

Another problem with powersaving was my mouse. Everytime I didn't plugged in my powercord, I had a very stuttering cursor. So I wrote another udev rule:

SUBSYSTEM=="usb", ATTR{idVendor}=="1d6b", ATTR{idProduct}=="0002",  ATTR{power/control}="on"

It is nearly the same except of the "search attributes".

Comments (0)

2013-03-17 17:08:23