Category Archives: Snippets

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

:BundleInstall

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

~/.mozilla/firefox/<profile>.default/places.sqlite

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?
ipv6_2014

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"])
    plt.show()

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.

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:

#!/bin/bash

# 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:

#!/bin/bash

# use nested xserver as output
export DISPLAY=:1.0

kodi

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

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.