All posts by basti

No Python Completions in Vim

Some days ago I copied my .vimrc to another computer. I use some plugins managed by Vundle, so I did the usual


Everything seemed to work fine until I tried to complete some Python code:

Error: Required vim compiled with +python
E117: Unknown function: pythoncomplete#Complete

That’s weird. Okay, let’s check if there’s really something wrong with my vim (from the jessie Debian sources):

$ vim --version | grep python
+cryptv +linebreak +python +viminfo
+cscope +lispindent -python3 +vreplace

No problem here. But where do I get the Python completions from? (I’m actually not the only one wondering).

The answer is the virtual package vim-python provided by:

  • vim-nox
  • vim-gtk
  • vim-gnome
  • vim-athena

So I ended up install vim-nox. It turned out that I had already installed this on my other computer.

My personal IPv6 report for 2014

It’s once again time to check how many hosts we visited over the past year already provide their service via IPv6. And yes, this particular host is not IPv6 ready, at least not right now. Some years ago I configured all services to use IPv6, but in the meantime I tried to move all services into LXC containers and I did not manage to get it working yet. Anyway, let’s cut to the chase.

I run a small Python script every year that queries my Firefox’s history SQLite database. It’s located somewhere in your home folder, probably in


Call the script with the places.sqlite as first argument and it will try to resolve each hostname you visited in 2014 (or what’s left of the history depending on your history cleaning habits). Maybe you noticed the getaddrinfo call on line 28 and that there is no actual check whether the web server is really listening on the correct interface. Yes, this is only a rough measurement of available AAAA resource records.

My results look pretty much like last year’s:

938 out of 5126 hosts are IPv6 ready (18.29%).

How about a nice xkcdish chart?

from matplotlib import pyplot as plt
with plt.xkcd():
    plt.pie([81.71, 18.29], colors=['r', 'g'])
    plt.title("IPv6 in 2014")
    plt.legend(["IPv4 only", "IPv6 ready"])

Let’s finally take a quick look into the places.sqlite, because there are some interesting things hidden in it. Sarah Holmes had a look some years ago.

In the table moz_places is a link to the favicon table, so if you want to, you can compile yourself an image or chart with the favicons of the websites you visited. You could use the visit count or the frecency score your browser calculated. There’s also information whether you typed the URL or clicked a link/visited it via bookmark.

You could reconstruct your download history with moz_annos, reuse your bookmarks, or even follow all your steps through the interwebs like Sarah did with moz_historyvisits. You could even analyze your input habits (moz_inputhistory) – pretty creepy if you ask me.

Why I chose the MPL 2.0 license

It’s always a struggle when it comes to licenses, but no license is no solution, unless you don’t believe in the concept of free/libre software. The licensing decision is easy when it comes to text – at least for me. The Creative Commons folks developed a nice licensing toolset. You can basically choose one by clicking some checkboxes. I came up with a CC-BY license pretty fast, but to be honest I kept an eye on Creative Commons for quite a while. I picked attribution as the only condition in order to share and remix my work. Unfortunately Creative Commons wasn’t made for software.

Whenever I thought about software licensing, GPL popped in my mind. Probably because it’s the most famous and widely used license around when we’re talking Free Software. However GPL has some issues when it comes to reuse of code. The obstacles one has to face when using GPL code are pretty high, especially these:

Whenever you use GPL code..

  • your project’s license must be GPL
  • you must disclose the whole sourcecode of your project

Jeff Atwood describes it as following:

The archetypal bearded, sandal-clad free software license. Your code can never be used in any proprietary program, ever! Take that, capitalism!

– Coding Horror: Pick a License, Any License

I don’t want to force people to use a specific license and disclose the complete sourcecode, although that would be awesome. However it’s far from reality.

Richard Stallman, the main author of GPL, said on the 31C3:

What if you have no money? And you need to eat something, you’re hungry. Well, you don’t have to limit yourself to these options [writing free/libre or proprietary software], because you got a better option, which is steal some food. It’s not exactly nice, but it’s better than developing proprietary software. That’s really wrong!

Richard Stallman – Freedom in your computer and in the net (00:14:35)

Yes, free/libre software should be the maxim, but I would not agree with Mr. Stallman’s attitude concerning everything besides it.

People want to use code off the internet in their daily jobs working on proprietary software. And they tend to do so without looking at the licenses. I think the only way to recover a grasp on reality is to use licenses with meetable conditions.

Then there is the BSD or MIT licenses, the antidotes to GPL. It gives you the freedom to use code as long as the BSD copyright notice stays intact and you use another name. If you want to give even more freedom, you might think about WTFPL, the “Do What The Fuck You Want To Public License”. I thought about using it, but it lacks a “no warranty” clause and there seem to be some legal concerns. At least I couldn’t find any court case where WTFPL has been recognized as a valid license.

What turned out to be my happy medium is the Mozilla Public License (MPL). It does neither try to force the project, which uses MPL code, to be under a specific license nor do you have to disclose the whole sourcecode. So where’s the difference to BSD/MIT licenses?

MPL says you must share back changes you made to the original code and only that. So if a company uses your wicked MPL-licensed XML parser and improves it, these changes have to be disclosed. I think the chances that a company will share back these specific pieces of code is far more realistic than turning the whole project into GPL code and disclosing it. So i’ll go with MPL 2.0.

Credits to Tobias Sjösten’s blog post “Open source licenses and the asshole clause”, which led me to the MPL license.

XBMC/Kodi fullscreen on TV (as second screen) with overscan

I own an old, no-name LCD TV (bought ~10 years ago) that I use to watch movies, TV series and sometimes YouTube from my couch using Kodi (previously called XBMC), a nice media center software. I connected the TV via DVI as the third screen to my Linux computer. Everything works good except one thing: I cannot see the whole screen.

This issue is called overscan and it’s mostly seen on old CRT screens. However some cheap LCD TV manufacturers seem to have adopted this to keep traditions. 😉 Maybe it’s just some kind of production error that causes the plastic border and the actual panel to overlap. I don’t really know. Some newer LCDs do have this problem too, but somewhere in the settings dialogue is a checkbox to (de)activate it. Unfortunately, mine lacks this.

So there’s a whole area near the borders hidden and I see cropped menu items. Furthermore I prefer to see the whole picture of a movie.

Kodi offers a calibration option, but only in fullscreen mode. I cannot use the other screens in fullscreen mode which comes handy sometimes.

My solutions is to run Kodi fullscreen inside Xephyr which is a nested X server, so I can use the Kodi calibration option.

If you’re using Debian, install it like this:

apt-get install xserver-xephyr

Here’s the snippet that starts Xephyr:


# launch nested X server
Xephyr -ac -br -noreset -screen 1280x720 :1 &

# wait for Xephyr
sleep 3

# move to TV
wmctrl -r "Xephyr" -e 1,0,0,-1,-1

# make it go fullscreen
wmctrl -r "Xephyr" -b toggle,fullscreen

It basically starts Xephyr with the resolution of the TV, moves the window to the correct screen and enables fullscreen mode. I run this script on startup.

All there’s left to do is to run Kodi inside the nested X server:


# use nested xserver as output
export DISPLAY=:1.0


After calibrating everything works as expected: I can finally use all screens while watching uncropped videos.

GIF Music Visualization

Disclaimer: This post documents a project I did half a year ago.

You might have seen short video snippets played in your favourite club. VJs sometimes use these or it’s part of the interior design of the club as general music visualization. Psychedelic effects or nice scenes from epic movies are shown to support the overall sound experience.

What about GIFs then? Sure, the quality is not what you want for HD/4K beamers, but just for the effect it can be good enough. There’s a GIF for every outstanding scene and slow motion sequence, so why not use that?

In my first approach I just wanted to see if it’s generally working, so I built a small script that uses pyGame to draw the corresponding GIF depending on data generated by Scott W Harden’s “Realtime FFT Audio Visualization with Python” (thanks a bunch!) which uses Fourier transform to calculate the data. I think it’s quite a cool looking and entertaining visualization. You can find it on GitHub.

The visualization is not limited to music, it will use any sound getting played. If you plug in a microphone, you can control the GIF by clapping or speaking. The script uses the highest values as upper limit. If you change your volume during a session, the limits won’t be correct. A restart helps in this case.

I found dubstep most suitable, because the volume ranges, silent sequences and frequency changes make a nice effect. I made two short YouTube clips, the first one uses a GIF with rising dough (original GIF):

In the second one I used an exploding watermelon GIF (original video credit):

The README on GitHub explains how to add new GIFs and answers some general questions, so have a look there. It would be cool if the script could react on other sound changes, but I’m no expert in this field. In fact, without Scott W Harden’s code the whole project would have been impossible. There were also some requests by Windows users who wanted to run it. I personally have no experiences with running Python code under Windows, but maybe someone out there likes to try that?

Audacity + PulseAudio = high speed playback & squeaky noises

I’m using Audacity for different audio cutting tasks on Debian Testing with PulseAudio. Some month ago everything worked perfectly. Several month before that it did not work at all.

Currently when I play an audio snippet, it’s playing incredibly fast and Audacity crashes. The current solution seems to be this:

env PULSE_LATENCY_MSEC=30 audacity

Use this command to launch Audacity from your terminal and it will work.

This solution is actually all over the internet, but I had a hard time finding it. So this might help the random Google user.

Welcome, welcome, welcome!

Introductions and motivations always were my weak spot and most first blog posts are a pain in the ass. And so are the comments.

Wow, so happy that you have a blog now. Looking forward to awesome posts. *subscribe*

– PurpleMonster91

Duuude, it’s 2015 and you’re starting a blog? Ha, lame!!

– Bernd

And let’s not forget about the obligatory..


– AwesomeAnon

Okay, then. Let’s face the inevitable question: why – for God’s sake – another blog? And why in English?

Wisdom of the Ancients
XKCD 979: Wisdom of the Ancients by Randall Munroe  (CC-BY-NC 2.5 )

Don’t you sometimes think about that annoying bug you experienced last week and you googled it for quite some time. Eventually the only Google hit turns out to be the souce code snippet that generated the error message in the first place. But then you come up with a cool hackish solution and you think “I’m probably not the only person on earth to have that error message thrown at their face”. But you have no outlet to publish it and nobody else can benefit from your solution. That’s far from ideal.

I have this haunting thoughts for several years now. And after all, fuck it, I’m starting a blog in 2015! It will be in English, so I can reach a broader audience that might benefit from this piece of randomness, at least in my mind.

I will write about future/done projects and random thoughts. Once in a while there will be that solution to a problem you just googled.

Peace out.