Tag Archives: Python

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.

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?