Category Archives: IT & Tech

Interesting stuff from the world of bits, bytes and hardware.

apache2 basic auth / ip based authentication

As I keep forgetting how this works, here’s an example config that will require basic auth for the “/” URI while permitting basic-authless access to “/test” for IPs listed in the Allow from statement (other source IPs will still be able to access stuff in “/test” if proper basic authentication info is provided with the request):

# httpd.conf 

# basic auth für "/" und "/test" except for IPs listed in the "Allow from..." Statement 

<Location /> 

   AuthType Basic 

   AuthUserFile /etc/httpd/conf/htpasswd 

   AuthName "Authorized Users Only" 

   require valid-user 


<LocationMatch /test/*> 

   Order Deny,Allow 

   Satisfy any 

   Deny from all 

   Require valid-user 

   Allow from AAA.XXX.YYY.ZZZ 


Changing the default sound output device in Counterstrike: Global Offensive (on Linux)

I know I’m about 10 years late to the party, but I recently picked up “Counter Strike: global offensive (“csgo” for short) on Linux when I found out the title was now free to play on steam.

My distro of choice is Linux Mint 19.2 and getting the game to run itself on Linux was not a big issue thanks to using modern drivers for my nvidia gtx1070ti, however no matter what I tried, csgo would insist on playing its ingame sound (both effects & VOIP) on my external speakers (when everybody knows you need a proper headset to fully enjoy the 3d effects the game provides).

After a lot of googling I finally found a workaround which involves some pulseaudio (PA) hacking, but seems to work ok in a reliable and repeatable manner.

The basic principle is that you redirect csgo’s sound output (a “sink” in PA lingo), after it’s been created,to the sound device of your choice.

You’ll need to alt-tab out of the game once it’s started but I’ve found the function is rather stable if you run csgo in “fullscreen windowed” mode.

Once csgo is running, alt-tab to a 2nd virtual desktop and open a shell.

In this new shell, we’ll need to determine the current index / id of the headset like so:

$ pactl list short sinks
0 wave_output modules/module-waveout.c s16le 2ch 44100Hz RUNNING

(the above is just an example as I’m typing this on a Linux VM). The number we need is the “0” in this case, choose this according to the index number where your headset is displayed in pactl’s output.

Next, we create a simple shell script (need to to this only once of course) with the following content, calling it “” or similar:

echo "Setting default sink to: $1";
pacmd set-default-sink $1
pacmd list-sink-inputs | grep index | while read line
echo "Moving input: ";
echo $line | cut -f2 -d' ';
echo "to sink: $1";
pacmd move-sink-input `echo $line | cut -f2 -d' '` $1



I’ve chosen $HOME/bin/ as my location for this script, but you can put that wherever you want as long as the directory is in your PATH.

Once you have that script at the ready and executable (chmod 755 ~/bin/ in my case), simply type <indexnumber>

where the <indexnumber> is the number that is displayed for your headset in the pactl output listed above.

Now you can cycle back to the virtual desktop that csgo is running on, hit alt-tab there and hey presto!, csgo should now be outputting its sounds to your headset.

Thanks to “Zanna” over at for the original script!

Restoring the GRUB boot sector on Linux Mint 19 / Ubuntu 18.04


Note to self: Always make a copy of your boot sectors using dd first. 
Note to world: These commands will only work if you have a separate boot partition. 

# take note of your Linux partitions (/dev/sde3 == /, /dev/sde1 = /boot in my case)

fdisk -l 

# Mount Linux partitions using your live installer cd / usb key: 

mount /dev/sde3 /mnt
mount /dev/sde1 /mnt/boot

# re-install grub to /dev/sda

grub-install --boot-directory=/mnt/boot /dev/sda 



Updating Lineage OS 14.1 on a Samsung Galaxy S3 (GT-9300i)

While lineage claims that the update process is mostly automatic on the Galaxy S III (gt-9300i), I found that after downloading an update and rebooting I ended up in my TWRP boot screen, with nothing much automatic going on at all.

It took me a while to determine the storage location of the downloaded updates (that much worked I’m happy to report), and it seems that for me (LineageOS 14.1) they end up on the internal SD card in a directory called



The trick was to use the “up one level” function in TWRP’s image selection to actually see the root level of the internal SD card.


Then, all I needed to do was to select the most recent update (it’s in zip format so you may need to switch the image / zip display in TWRP’s “install” screen, flash it (apparently you don’t have to wipe the cache for it to work), reboot the system and wait about 15 minutes, and hey presto!, here’s my most recent Lineage OS update running fine on my S III.

Caveat: During the initial migration from CM13 to Lineage 14.1, I found the system would not boot properly if I chose to select the “SuperSU” package as offered by the Lineage OS installer. Not choosing to install that package would allow the system to boot properly.

I hope this helps you updating and keeping current your beloved GT-9300i phone!

Increasing the number of open files for MariaDB 10.1 on CentOS7 (openstack pike RDO install)

(c) stackhpc

Our openstack pike installation crashed after a couple of days with tons of error messages in /var/log/mariadb/maria.log in the form of

Error in accept: Bad file descriptor

Some googling  hinted at mariadb running out of open files, but I had some problems getting to grips how to set the number of open files for mariadb 10.1.20 (used by the rdo openstack-pike) on a CentOS 7 system, so here’s for posterity:

1)increase the ulimit in /etc/security/limits.conf as usual:

* hard nofile 1024000
* soft nofile 1024000

2) create the file (if it doesn’t exist, otherwise edit the existing file) /etc/systemd/system/mariadb.service.d/limits.conf 

and add the following lines


2a) reload systemd

# systemctl daemon-reload

3) restart mariadb

# systemctl restart mariadb.service

4) check the results

# mysql -pXXXXXXXX mysql

MariaDB [mysql]> show global variables like 'open%';
| Variable_name | Value |
| open_files_limit | 1024000 |
1 row in set (0.00 sec)

5) Enjoy a hopefully crash-free OpenStack Pike setup 😉


Setting up & running letsencrypt a.k.a. certbot on CentOS / RHEL 5 systems


Getting letsencrypt to run on an ancient CentOS  or Red Hat Enterprise Linux 5 system (they still tend to appear in the wild from time to time) can be a major headache. I took some notes during the setup, I hope you find the useful (you'll need some basic Unix admin skills in order to follow this recipe, so caution is advised as you go through the procedure). 


Important: You'll need to use Python 2.7.8, anything beyond that version will
die with an invalid certificate error during the certbot setup phase. 

# compile openssl from source:

mkdir -p /server/src && cd /server/src


tar xvzf openssl-1.0.1t.tar.gz && cd openssl-1.0.1t

./config --prefix=/server/openssl-1.0.1t shared --openssldir=/server/openssl-1.0.1t/openssl

make depend && make && make install

# create a softlink for convenience 

ln -s /server/openssl-1.0.1t /server/openssl

# Get Python 2.7.8

cd /server/src && wget

tar xvzf Python-2.7.8.tar.gz

cd python-2.7.8

# set up compile environment

export LDFLAGS=-"Wl,-rpath=/server/openssl/lib -L/server/openssl/lib -L/server/openssl/lib64/"

export LD_LIBRARY_PATH="/server/openssl/lib/:/server/openssl/lib64"

export CPPFLAGS="-I/server/openssl/include -I/server/openssl/include/openssl"

./configure --prefix=/server/python-2.7.8

make && make install

# create softlink, adjust PATH

ln -s /server/python-2.7.8 /server/python; export PATH=/server/python/bin:$PATH

# install pip in new python version

wget --no-check-certificate


# install virtualenv, wheel

pip install virtualenv wheel

# git-clone certbot (latest version)

 cd /server/src/ ; git clone

# Request a certificate manually (certonly)

cd certbot; ./letsencrypt-auto certonly --manual -d my.server.tld 

# configuring your webserver of choice is left as an exercise for the reader.


VBulletin keyboard navigation (a bit half-****, but works)


I really don’t like web forums all that much, I think they all suck in one way or another and I really yearn for the good old USENET days when everybody was free to use their reader of choice… well, those were the days.


With “vBulletin” being a vey prolific and widespread software for many forums / fora / forae I visit regularly, I wanted to bring some comfort back to browsing them by adding some simple keyboard navigation using some javascript I freely “borrowed” from the web sites out there.


Here’s the result:


“n” – Search for new posts

“g” – go to the first post in the list of new posts

“j/k” – navigate forward / backward in the pages of a thread and / or search results

Cut & Paste the script below and save it to a location of your choice, then you can use the  “tampermonkey” extension for Chrome and other browsers to enable these features (chrome stopped accepting non-store based extensions a year ago for whatever reasons they saw fit, tampermonkey helps to get chrome back under the user’s control)

Add the URLs of your favourite forums to the script and import it into tampermonkey (some niftier form of configuration may be on the cards, but I’m lazy so feel free to add it yourself if you want to).

I hope you find this script useful, enjoy keyboard navigation in vB! 😉

VBB “What’s new” user Script

// ==UserScript==
// @name VBB Show new posts
// @namespace
// @description Adds a "whats new" search link and some shortcuts to vbb forum pages
// @description Download URL:
// ##### ADD THE URL of your vB forums below ##################
// @include http*://**
// @include http*://**
// ==/UserScript==

var EuropeanDateFormat=1; 
var newlink = document.createElement('a');
var todays_posts = document.createElement('a');
newlink.href = 'search.php?do=getnew&contenttype=vBForum_Post';
todays_posts.href = 'search.php?do=getdaily&contenttype=vBForum_Post';
tn = document.createTextNode(' Show new posts ');
tn2 = document.createTextNode(' Show todays posts');

var footer = document.getElementById('footer_links');

if (footer) {

// quick hack to set a default email address
from = document.getElementById('it_from_3');
if (from) {

if (EuropeanDateFormat == 1) {
 var dates = document.getElementsByClassName('date');
 for (var i = 0 ; i < dates.length ; i++) {
 var post_date = dates[i].innerText;
 // check if there's a year string in the -2012 notation (will stop working in 2100 ;-) 
 if (post_date.indexOf("-20") != -1 ) {
 year = post_date.substring(6, 10);
 month = post_date.substring(0, 2);
 day = post_date.substring(3, 5);
 var new_date = ""; 
 dates[i].innerText = year + "/" + month + "/" + day; 

// stolen shamelessly from's facebook key navigation
// Thanks to Droll Troll

function OnKeyUp(e)
 var anchors = document.getElementsByTagName('a');
 for (var i = 0 ; i < anchors.length ; i++) {
 var href = anchors[i].getAttribute('href'); 
 if (href) {
 if(href.match(/goto=newpost/)) {
 break ; 

 // do a search if we cannot find the "next page" link
 next_page_or_new ="search.php?do=getnew&contenttype=vBForum_Post"
 for (var i = 0 ; i < anchors.length ; i++) {
 var next_page_href = anchors[i].getAttribute('href'); 
 var title01 = anchors[i].getAttribute('title'); 
 if (title01) {
 if(title01.match(/Next Page/)) {
 next_page_or_new = next_page_href
 break ; 

 prev_page_or_new ="search.php?do=getnew&contenttype=vBForum_Post"
 for (var i = 0 ; i < anchors.length ; i++) {
 var prev_page_href = anchors[i].getAttribute('href'); 
 var title01 = anchors[i].getAttribute('title'); 
 if (title01) {
 if(title01.match(/Prev Page/)) {
 prev_page_or_new = prev_page_href
 break ; 

 key_map = {
 "N" : "search.php?do=getnew&contenttype=vBForum_Post",
 "G" : href,
 "K" : next_page_or_new, 
 "J" : prev_page_or_new, 
 "T" : 'search.php?do=getdaily&contenttype=vBForum_Post'

 if (String.fromCharCode(e.keyCode) in key_map && 
 (typeof == "undefined" || ( != "text" && != "textarea")) && 
 !e.altKey && !e.ctrlKey && e.keyCode <= 90)

window.addEventListener("keyup",function(event) { OnKeyUp(event); },false)

Nethack 3.6.0 for Debian / Ubuntu Systems


As you may have heard, the NetHack Devteam blessed us with an update to everyone’s favourite roguelike game “Nethack” a few months ago. As I was unable to track down a precompiled version, I compiled this version from source on my Ubuntu LTS machine.

The package isn’t signed and it might break on your system (hopefully not “your system”), but I’ve decided to put it out there anyway.


nethack360_3.6.0-1_amd64.deb for 64bit systems, Ubuntu LTS 12.04 (may also work on 14.04)

nethack360_3.6.0-1_i386.deb for 32bit systems Ubuntu LTS 12.04 (may also work on 14.04,)


nethack360_3.6.0-1_amd64.deb for 64bit systems Ubuntu LTS 14.04

Use these debs at your own risk, if they break, you get to keep both parts 😉

Feel free to comment here if you come across any problems and I’ll do my best to fix them.



Fixing FaceTrackNoIR head tracking with 64bit game binaries

If you’re like me, you’re both a simracing and flightsimming buff. My sims of choice are rfactor2 for simracing and Falcon BMS (4.33 was released not too long ago) for flight sims.

While using a head tracking device feels very natural when it comes to flightsimming (I’m using the excellent DelanClip with FaceTrackNoIR), it always felt strange when simracing in rfactor2, I just couldn’t get used to it. The fact that the stock FTNoIR install didn’t work with the 64bit rfactor2 executable didn’t help, either.

Shtalik” on the BMS forum came up with a solution: Simply use the npclient64.dll from the OpenTrack zip archive and extract it to your FTNoIR directory. Following that, you should not have any problems enjoying head tracking in your favourite 64bit sim of choice.



Yet another Python-based vcalendar parser you can use with “Mutt”

The Mutt email client at work… thanks to

I’m still using “Mutt” as my main email client if you can believe it, and yes, I know it’s 2015. Still for me personally nothing allows me to work through my daily inbox at work (which can easily grow to 1,000 new messages a day) quicker than a keyboard-controlled, ASCII only email client like the venerable mutt (before that, I migrated from Unix’ old “mail” to “elm” in case you remember those).

No matter what tool I tried when attpempting to teach Mutt to show event invitations, parsing exchange-generated vcalendar events never worked properly for me, so I decided to come up with my own (much like every Python hacker worth his salt has to come up with an entire scratch built CMS framework at some point ;))

You can find the results below — as usual, the code is butt ugly (for some reason, my Python has started looking even worse than my Perl recently if such a thing is possible), but it does the job and works for me; YMMV.  You’ll certainly need to translate the field labels into your own language, but that shouldn’t be too difficult. You can then use mutt’s “auto_display” function to call the script automatically on text/calendar entries.


#!/usr/bin/env python
import sys

from datetime import *

def date_to_string(d):
 # 20151006T103000
 dt = datetime.strptime(d, "%Y%m%dT%H%M%S")
 return "%s (%d days)" % (dt.strftime("%A, %d. %B %Y, %H:%M Uhr"),
 abs (dt-now).days)


if __name__=="__main__":
 for l in data:
 if l.find("ATTENDEE") > -1:
 attendees.append(l.strip().split(";")[4].replace('CN="', '').split(",")[0])
 if l.find('DTSTART;')==0:
 if l.find('DTEND;')==0:
 if l.find('SUMMARY;')==0:
 if l.find('ORGANIZER;')==0:
 organizer = l.strip().split(";")[1].replace('"', '')
 orga_name, bla, orga_mail = organizer.split(":")
 orga_name=orga_name.replace('CN=', '')
 if l.find("LOCATION;")==0:
 location=l.strip().split(":")[1].replace('\\', '')

 if l.find("TZID:")==0:
 print "===================================================================="
 print "Thema : ", event_subject
 print "Ersteller : ", orga_name
 print " ", orga_mail
 print "Start : ", date_to_string(event_start)
 print "Ende : ", date_to_string(event_end)
 print "Zeitzone : ", time_zone
 print "Ort : ", location
 print "Teilnehmer: ", ", ".join(attendees) 
 print "===================================================================="

A fresh Look at Linux Mint 17.2

Linux Mint “Rafaela” 17.2

Back in the day, I used to be a Linux Mint user and advocate, going back to Mint 7 and Mint 8. I just loved the fresh, modern and mostly mint-green looks of the interface, the painless installation and its ease of use even for folks that were new to Linux, so I guess you could call it my “mom and dad” distro of choice (in fact, my Mom used Linux mint ever since she started dabbling with computers and the internet until she passed away in 2010).

I got fed up with Mint because of the seemingly stubborn refusal by the Mint team to support non-destructive upgrades between releases; if you wanted the newest, freshest Mint, a complete re-install would be on the cards.  I eventually ended up being an Ubuntu user (again), mostly in the form of the XFCE-based xubuntu or Lubuntu which uses the LXDE desktop by default.

When my brother in law Keith asked for my help in breathing new life into his malware ridden win7 “home premium” Fujitsu notebook a few weeks ago, I naturally tended towards xfce because of its rather modest hardware requirements, but while preparing a bunch of USB media to boot and install from I thought “What the heck” and downloaded Linux Mint Cinnamon edition (64bit, version 17.2).

A quick check showed the usb stick to boot fine and boy, was it quick! I hadn’t looked at cinnamon in a while either, and I really liked what I saw, with the numerous codecs and add-on software that comes with Mint (1,6GB iso compared to a meagre 800MB or so for xfce) it was an easy choice with Mint to get my in-law up running in the shortest amount of time.

With Keith being a scout leader, I realized that windows office compatibility and good hardware support (skype, printing, scanning what have you) would be a great bonus.


The first major disappointment was on the cards for us when we found no way of reducing the NTFS partition on the notebook. I seem to recall this being possible in earlier Ubuntu (which mint is still based on) and Mint releases, but this feature seems to have been removed. Just to make sure I checked xubuntu 14.04 and 15.04 which I’d also available on USB sticks, but sure enough those distros didn’t support shrinking the windows partition, either.

As we had a backup of most of the important stuff on an external drive this was no major obstacle though, so we decided to wipe the entire disk and configure it for Mint’s exclusive use.

The rest of the installation was easy and went quickly as expected.


Network config was painless and worked out of the box, both for the ethernet port and the wireless chip, but that’s to be expected these days. During the installation Mint downloaded updates and extra language packs which is a nice bonus.

Hardware support

Installing the Brother printer drivers wasn’t quite as easy, and I guess a Linux newbie would have given up here, but as I’ve been a Unix user since 1990 or so I wasn’t fazed by the text-based shell script installer wrapper that’s provided by Brother (yes, they do list Linux as a supported OS on their homepage, nice!), so the only problem we had was to find out the printer’s IP address on the LAN (I have no idea why the printer part of the installer was able to determine it automatically, but the scanner software installer asking for the IP address specifically).

Sure enough, printing worked and even scanning was supported using the “simple scan” tool, and, to be honest, non-SCSI scanners (remember those?) have been notoriously difficult on Linux in the past  (especially those all-in-one printer / scanner / copier crap garbage printers by HP and the like), so I was very pleasantly surprised when everything worked just great.

Multimedia & Networking: Skype

Next on the list was “Skype” which Keith uses to stay in touch with his Scout leader mates and his family back in England. Installation was a breeze using apt with Skype readily available via the stock Mint repo), and in short order we were able to place a test call with a friend. However the internal speakers being broken in the notebook, Keith got a headset to check the audio output, and my heart skipped a beat when he (rather mindlessly) plugged in a USB headset, simply expecting it to work, I knew we were in trouble from here.

To my amazement, as soon as he’d plugged in the headset, it started working in Skype as if by magic, no reboot / pulseaudio stuff or even a Skye restart required. Amazing how far Linux has come in terms of hardware support!

Multimedia pt. II: Banshee

As we had to kill Keith’s MP3 collection when formatting the hard disk (there simply wasn’t time to copy it all over to the usb drive), we were naturally interested in how to rip his CD collection in Mint. Being  the “bearded type” Unix user, I told him I’d use ripperX for that purpose, an ancient perl wrapper around several multimedia tools. Before I’d finished the sentence, he’d jammed an Audio C/D in the notebook’s cdrom drive and was ripping it to  his “Musci” folder using Banshee’s “Import Media” function.

“Aha”, I went, “hang on, this is surely going to be OGG Vorbis which will get you in trouble if you try playing it on your car’s stereo”, so I checked the Music folder expecting a bunch of (technically superior, but not yet as widely supported) OGG Vorbis files.

No, another surprise: Familiar “.mp3” tags all over the place, fantastic. We tried a more esoteric piece of his collection which I was sure would not be recognized as a known album online, but sure enough Banshee was able to download track / title / album info from the depths of the net just like it was nothing. Wow! Just wow. This was getting very interesting.

Multimedia pt. III: Playing DVDs

VLC by VideoLAN

I was quickly running out of things that usually break on a fresh Linux install, so trying encrypted DVD playback was on the cards next.

“True Grit” went into the notebook’s drive, VLC came up, the menu played, one more click and were happily watching the movie in VLC, effortlessly switching between scenes, audio tracks and whatnot. Another wow from your “Unix bearded” type, for Keith it was the expected behaviour I guess 😉


Multimedia pt iV: YT & Friends

4k video downloader in action

Ok, you know the feeling: You watch a nice music vid on Youtube and would like to keep  / download for offline use.  I had heard of 4k video downloader, but had never tried it personally, so we were able to download it from the website, right click on the package and select “Install using GDebi” and we were downloading stuff from YT about two minutes later, even being able to extract the audio part only and integrate it into the music collection automatically. Nice!


Alternative Browsers

Being a Firefox user on Windows, Keith was rather happy to find Firefox available on Mint as the default browser, but he’d heard of google Chrome but wasn’t too pleased about the company’s policies. So in order for him to be able to try an alternative browser, I installed Chromium (again from the repos so it was just an apt-get away) so he could take a look at a different and leaner browser (some might argue this point, but I’ve found Chromium to be quite a bit faster than Firefox on similar hardware).

Suspend / Resume

Another thing that has been quite finicky in the past on Linux based Notebooks is the power management, especially suspending and resuming the OS from hibernation. Everything appeared to work flawlessly on Linux Mint here: The system went to sleep properly using the swap partition (?) for the memory image and resuming when opening the lid again.


Linux Mint has come a long, long looong way since I last gave it a good, hard look in the form of the first “Linux Mint Debian Edition” a few years back (then hoping to avoid the “reinstall” issue in order to upgrade to the latest release). While I have no idea how long 17.2 is going to be supported, I feel we’ve found the optimal “Newbie” distro again for a casual computer user where all he / she needs to do is to browse the web, do some word processing / spreadsheet stuff, check their emails and do some multimedia stuff every once in a while.

Linux Mint 17.2 looks great, has a comprehensive feel to it that comes across as very integrated and apparently the designers have given some serious thought to choosing the best applications for the job. There’s always more from the plethora of apt repos if you need it, but the default choices made seem to be very good.

I’d recommend Linux Mint to anyone wanting to take a quick, fresh look at a modern Linux desktop distro, and I’m quite sure it’s going to make its way onto my next notebook.


All media content has been imported / linked to from the original (c) holder’s web sites. Please let me know if there is a problem with that. Thanks!

IBus / openbox eats Ctrl-Space… how do I set the mark in GNU Emacs?

GNU Emacs: The Editor to Rule Them All

This problem has been bugging me for a while now until finally today I sat down trying to fix it.

This post

on the GNU mailing list had the working and simple solution: ibus maps Ctrl-Spase to “next input method”, so all one needs to do is to run “ibus-setup” from a terminal and map this function to some other keyboard combination that’s not frequently used, and hey presto!, setting the mark in GNU emacs works again as expected.

Happy holidays!