Code Samples

WordPress emergency admin

I received an emergency call from a client, his WordPress site didn't work. None of the logins either. Well, here's another script to the rescue if all you have left is an ftp login or some other way to upload files. It will create a new admin user with the ... more

Pepperflash plugin in wheezy fix

The pepperflashplugin-nonfree package in wheezy-backports is broken, as it downloads the flash plugin from the latest chrome release and installs it. The latest release links against libc6 2.14 which is not available in wheezy. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=761184 https://lists.debian.org/debian-backports/2014/09/msg00051.html more

Gradient as Gnome 3 background, from the command line

This was quite easy, but I had to find the necessary bits of information first. I wanted to set the Gnome 3 background to a gradient, from the command line. Below I also list the commands that let you explore available keys and values. more

Irssi, hilight and regex

I use irssi for IRC and wanted to highlight various regexes in different channels. Unfortunately the help text wasn't very helpful, so here's an example. more

Django and Invalid HTTP_HOST headers with nginx

Django has had a setting for allowed hostnames for a while [1], but starting with the 1.5 release it was required [2] to set it. I'm not sure why I only started getting Invalid HTTP_HOST header emails after my upgrade to 1.6, but anyway, they started pouring in. It's a ... more

Mount samba shares from fstab

So... I had to check my backups just to figure out how to mount my shares. How annoying is that? On Debian-based systems you need to install cifs-utils. more

Change initial header level in docutils

I use reStructuredText on parts of this site to write HTML content. But as the main headers don't originate from the rst content I need to start with an h2 tag. It's just a matter of rtfm but here's a solution. more

Cache busting with nginx

Here's a little snippet for cache busting without abusing a query string which can lead to caching problems. The example below will rewrite paths like /css/foo_20130401-5.css to /path/to/static/css/foo.css on the static.example.com host. more

Django almost spaceless template tag

Django has a {{ spaceless }} tag that's a little too greedy for my taste. Removing all whitespace between HTML tags can actually change what the browser renders, so here's a less greedy variant. However, it removes all whitespace, not just between tags, so if you use the pre tag ... more

Keyboard MB110 on Linux

So I got myself a new keyboard. It's an Apple MB110 (D/B variant). Works flawlessly in xorg after configuring it. more