MSSQL ODBC Client on Debian 9 Stretch

Many years ago fREW Schmidt wrote a very handy article on installing MSSQL ODBC drivers in debian. Since then Microsoft have improved their support of debian somewhat and things have changed making it easier to install, however they still (as at 2017-11-06) have not released proper drivers for Debian Stretch.

Add the microsoft repo

echo  'deb [arch=amd64] jessie main' > /etc/apt/sources.list.d/mssql-release.list

Add the key

curl | sudo apt-key add -

then update and install

sudo apt update
sudo apt install msodbcsql mssql-tools

If you try and connect to sql now you get an obscure error like this:

/opt/mssql-tools/bin/sqlcmd -S -U xxx -P yyy
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Can't open lib '/opt/microsoft/msodbcsql/lib64/' : file not found.

But the file exists:

$ file /opt/mssql-tools/bin/sqlcmd
/opt/mssql-tools/bin/sqlcmd: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/, for GNU/Linux 2.6.32, BuildID[sha1]=21a353af470e7849544daab892ec9b1bfc36dc87, not stripped

This somewhat misleading error is actually due to the libmsodbcsql lib being linked against a very specific version of  libssl. Check the output of ldd:

$ ldd /opt/microsoft/msodbcsql/lib64/ | grep 'not found' => not found => not found

But it turns out this can easily be solved by manually installing the libssl package from Debian Jessie:

sudo apt install ./libssl1.0.0_1.0.1t-1+deb8u7_amd64.deb

then you should be back in business.

I made a ukulele tuner web app

close up of a ukulele
Ukulele by texasfeel  (CC BY-ND 2.0)

I got sick of all the ukulele tuner apps so I decided to make my own. The best ukulele tuner app I’ve found on the iPhone works by repeatedly playing the note you are tuning to rather than trying to analyse the audio and display the frequency of the note it detects. The human ear is still better than software at doing that in my opinion.

It’s pure html and javascript. I used the howlerjs javascript framework for playing the audio as I found the basic javascript audio functions not precise enough for the looping.

The audio samples came from courtesy stomachache.

Ukulele Tuner

convert mp3 to m4b on the linux command line

I quite often want to convert mp3 files to m4b, Apple’s proprietary nastiness. There is pacpl of course but that has issues these days, particularly with copying the id3 tags to the new file.

FFmpeg can do it when you build from source (I just found a nice script that will build it from source for you). So I came up with this way to do it from the command line. It uses an awesome feature of xargs which will run it in parallel, so one for each core.

find -type f -name \*.mp3 \
| xargs -n 1 -P $(getconf _NPROCESSORS_ONLN || echo 1) -i \
  bash -c \
 'i="{}"; ffmpeg -y -i "$i" -map_metadata 0 \
        -c:a libfdk_aac -b:a 128k\
        -map_metadata:s:a 0:s:a -f ipod "${i%.*}.m4b"'

What that does is:

  1. find all the mp3 files and pipe their names into xargs
  2. then get the number of cores available and pass that to the -P argument
  3. and run ffmpeg and map all the metadata to the new file
  4. and strip off the mp3 file extension and add m4b to it

There! Nothing to it!

Update 2017-03-23: Added double quotes around the bash variable $i to cope with spaces. You should always do this (and so should I)

Wan’t to help organise a Perl conference in Sydney in 2017? Apply within!

Some of us at the Sydney PM group and the #australia  Perl IRC channel have
been discussing holding an perl conference in Sydney in 2017.

If this is something you are interested in attending or organising,
please get in touch.

You can find us on #australia on or Join our conference
organising mailing list:!forum/sydney-perl-conf-2017

First thing we need to do is form an organising committee. Let me know
if you are interested to be a part of that?

Looking forward to hearing from you.

Automatically lookup amazon books on booko

amazon logo loves booko logo

I love books and I love booko. So I decided to help Amazon help me check prices on booko with a little Tampermonkey script. It makes the ISBN-13 on Amazon a clickable link that will open a new tab to booko and search for that ISBN. Give it a go!

// ==UserScript==
// @name         booko amazon ISBN link
// @namespace
// @version      0.1
// @description  Make the ISBN-13 a clickable link to booko.
// @author       Jason Lewis
// @match*
// @copyright 2016+,
// @grant        none
// ==/UserScript==
(function() {
    'use strict';
    //var hrefs = new Array();
    var elements = $('#productDetailsTable > tbody > tr > td > div > ul > li');
    elements.each(function() {
        if ($(this)[0].innerText.indexOf('ISBN-13') !== -1 ) {
            var isbn=$(this)[0].innerText.replace(/ISBN-13:\s*(\d{3}-\d{10})/,"$1");
            console.log('isbn is: ' + isbn);
            var url = '' + isbn;
            var a = document.createElement("a");
            var text = document.createTextNode('ISBN-13: ' + isbn);
            var li = document.createElement("li");


I am transitioning GPG keys

Hash: SHA1

I am transitioning GPG keys from an old 4096-bit RSA key to a new
4096-bit RSA key.

This transition document is signed with both keys to validate the

If you have signed my old key, I would appreciate signatures on my new
key as well, provided that your signing policy permits that without
reauthenticating me.

The old key, which I am transitional away from, is:

pub   4096R/505E764E 2011-06-28
      Key fingerprint = B10B 2E72 BB30 FE47 ABC2  F1B9 FA57 1EC7 505E 764E

The new key, to which I am transitioning, is:

pub   4096R/93176CCD 2016-10-14 [expires: 2026-10-12]
      Key fingerprint = 4639 4DFE EFF0 344F E116  E974 C4E9 00B0 9317 6CCD

To fetch the full new key from a public key server using GnuPG, run:

gpg --keyserver --recv-key C4E900B093176CCD

If you have already validated my old key, you can then validate that
the new key is signed by my old key:

gpg --check-sigs C4E900B093176CCD

If you then want to sign my new key, a simple and safe way to do that
is by using caff (shipped in Debian as part of the "signing-party"
package) as follows:

  caff C4E900B093176CCD

Please contact me via e-mail at <> if you have any
questions about this document or this transition.

  Jason Lewis
Version: GnuPG v1