pass and a GNOME search provider

I have been using pass, the “standard unix password manager”, for quite a while now. And I love having it at my disposal because I cannot remember all the account names and different passwords associated with them. Moreover, I can easily distribute the passwords by cloning a repository on the machine I want to have them on. The basic idea is stupidly simple: you tell pass your default GPG key that it uses to symmetrically encrypt a file containing the password and additional metadata. Groups of passwords are created storing them in different sub-directories. On password retrieval pass will print the password or copy it to the clipboard for a limited time.

Now, I love the command line but my main use for a password manager is of course to store passwords for websites. Therefore opening a terminal typing pass and tab-complete the correct password is time consuming and slow. Thankfully, Jonathan Lestrelin wrote a search provider for GNOME shell which means you can simply type the meta key and the password and it will ask pass to open the chosen password. Unfortunately, the search itself was implemented by matching the search term against a regular expression which works well if you type the groups and passwords correctly but fails if you want to search more lazily. I asked for inclusion of a very simple difflib.SequenceMatcher ranked search and now that it is in, it’s just perfect.


Moving music content

I decided to move all music and bass related content to its own platform over at music.bloerg.net because it does not really fit the technical stuff here. No redirects were set up, so if you happened to have linked there … update your links accordingly.


Converting PDF pages to a single image

I am always amazed how far one can get by chaining the output of simple programs to create something bigger. This time, I had to convert the pages of a PDF file to a single PNG thumbnail image. As I learned in five minutes this is super simple with pdftoppm, Imagemagick’s convert tool and a Makefile to hook it up together:

%.png: %.pdf
	pdftoppm -png $< tmp
	convert +append tmp-* -resize x320 -unsharp 0x1 $@
	rm tmp-*

What I do here is calling pdftoppm to generate numbered PNG files with a tmp- prefix. convert reads them, appends them horizontally (denoted by the + sign), resizes the final image to a height of 320 pixels and filters the output with an unsharp mask to “recover” some of the lost sharpness.

To make the pages stand out you can also add a black single pixel frame and a white separation border with

%.png: %.pdf
	convert $<-*.png -resize x320 -unsharp 0x1 -bordercolor black -border 1x1 -bordercolor white -border 2x2 +append $@

Beamer, movies and Linux

tl;dr: On a stock Ubuntu 16.04. system build your presentation with pdfLaTeX or LuaTeX and use Okular to display it.

TikZ animations are a great way to illustrate dynamic processes in your Beamer presentations but are not suited for movies. So far, presenting movies on Linux has been pretty dull but eventually I figured out what works (and what not). First of all you, need to include

\usepackage{multimedia}

in your preamble which gives you the \movie command in order to include a reference to the movie file and a placeholder text/image/whatever that is shown as long as the movie is not played:

\movie[width=9.6cm, height=5.4cm]{
 \includegraphics[width=9.6cm, height=5.4cm]{still}
}{movie.wmv}

In most cases, the first frame of the movie would be a good canditate as a placeholder. To get the first frame you could use ffmpeg:

ffmpeg -i movie.wmv -vframes 1 -f image2 foo.jpg

Now, the first hurdle is to compile the presentation and unfortunately you will find out that XeTeX does not work with the multimedia package. So, either compile with LuaTeX if you want to use system fonts or compile with regular old pdfLaTeX.

To display your presentation you could use Evince but it will display the animation only in windowed mode, in the presentation mode nothing happens for me. KDE’s Okular has no such limitation and works fine with a PDF containing a movie. Note though that the movies are not baked into PDF but linked to. This means, you must deliver all files side-by-side.