A20-OLinuXino-MICRO 5V SATA MOSFET repair

I have an Olimex A20-OLinuXino-MICRO board that I use for running embedded Linux (armbian). It is a very nice board with an Allwinner A20 dual core ARM processor, 1GB RAM and a lot of connections. The features I like the most are the SATA connection and the integrated LiPo battery charger. It is like a uninterruptible power supply on board!

Unfortunately both the 5V connection for the SATA drive and the LiPo battery connection are close to each other and they have exactly the same female JST connector. You  can probably guess what went wrong: I connected the LiPo battery to the 5V SATA connector and I plugged the 5V cable from the SATA drive into the LiPo connection on the PCB 😮

Luckily all Olimex hardware is open source and that is yet another reason I love this Bulgarian company! On the A20-OLinuXino-MICRO wiki page you can find a lot of information, including a link to their github repository that also includes the full schematic!

So let’s digg into the documentation and get this thing repaired… Continue reading A20-OLinuXino-MICRO 5V SATA MOSFET repair

Enabling HSTS in Apache 2.4

After securing one of my servers with Let’s Encrypt, I was a bit disappointed that my website only got an A result on the Qualys SSL Server Test. Why did I not get the much sought-after A+?

Browsing the Protocol Details of the report, I discovered that my website was lacking Strict Transport Security (HSTS) support. This is how I enabled it on my Apache 2.4 web server running on Debian 8… Continue reading Enabling HSTS in Apache 2.4

Moving files to subdirectories based on date in the filename

My camera produces JPG files that have date and time information in the file name. I want to  move the files to new subdirectories per year, month and day.
IMG_20150723_233831.jpg -> 2015/07/23/IMG_20150723_233831.jpg
IMG_20151001_174215.jpg -> 2015/10/01/IMG_20151001_174215.jpg

I wrote this small perl script to perform this task:

# Move files to new subdirectories based on file name.
# CC BY SA 2015, Lieven Blancke
# my camera produces JPG files named IMG_yyyymmdd_nnnnnn.jpg
# I want to move these files to subdirectory per year, month and day
# IMG_20150723_233831.jpg -> 2015/07/23/IMG_20150723_233831.jpg
# IMG_20151001_174215.jpg -> 2015/10/01/IMG_20151001_174215.jpg
use strict;
use warnings;
use File::Copy;
use File::Path 'make_path';

my $directory = './';

opendir (DIR, $directory) or die $!;

while(my $file = readdir (DIR)) {
	# ignore files beginning with a period
        next if ($file =~ m/^\./);
	# only files, no directories
	next unless (-f "$file");
	# only process files like IMG_yyyymmdd_nnnnnn.jpg
	if ($file =~ /^IMG_([0-9]{4})([0-9]{2})([0-9]{2})_([0-9]{6})\.jpg$/) {
		print "$file -> $1/$2/$3/$file\n";
		# create the directory $1, $1/$2 and $1/$2/$3 in one go
		# move the file to the directory
		move($file,"$1/$2/$3/$file") or die "Could not move file $1 to directory /$2/$3: $!";


D-Link DGS-1500-20 DHCP problem fixed

I had a very strange problem in my home network: some wired hosts did not get an IP address from my wireless router. After some sniffing with Wireshark, I concluded that this problem only occurred with hosts that were connected to my D-Link DGS-1500-20 gigabit Ethernet switch. Hosts that were connected to my wireless router received an IP address via DHCP without any problem.

I did not find any settings in the DGS-1500 that could fix this problem and even a factory reset (pushing the reset button) did not fix it. Eventually I was able to fix this problem by updating the stock firmware 1.00.013 to version 2.51.005!

Configuring the Cisco SPA112 2-Port Phone Adapter for 3starsnet VoIP

The Cisco SPA112 is an Analogue Telephone Adapter, you can configure this device to enable internet telephony (VoIP) for up to two analogue telephones.


After plugging in the power, ethernet cable and analogue telephone, you can check the DHCP status of your internet (Wi-Fi) router for the IP-address of the SPA112. I actually used the Network Discovery Android app to discover the device on my home network.

Now we have found the IP-address, let’s configure this puppy… Continue reading Configuring the Cisco SPA112 2-Port Phone Adapter for 3starsnet VoIP

Extracting audio from a YouTube video using avconv

You can download YouTube videos with the NetVideoHunter Firefox add-on. After installing the add-on, you can download a YouTube video by clicking the icon.


By default the add-on downloads the best available quality from YouTube, that is very convenient.

The downloaded file has an mp4 extension.  Using the libav command line tool avconv, you can extract the audio without transcoding. This way the process is very fast and the audio quality remains the same:

avconv -i testvideo.mp4 -codec copy -vn testaudio.m4a

The -codec copy option makes sure the audio is extracted without conversion an the -vn option excludes the video being written to the output file.

To install avconv on Debian:

sudo apt-get install libav-tools

Fix fraying shoelaces with heat shrink tubing

Normally the ends of shoelaces are protected with plastic caps to prevent them from fraying, but they sometimes break and get loose. Once the ends of shoelaces start fraying, it is very hard to put them through the tiny holes of your shoes.  This is an easy fix:

  1. Get some glue, the right size of heat shrink tubing and a heat gun (or a lighter)
  2. Put a little amount of glue on your finger and wet the ends of the fraying shoelaces with it.
  3. Cut a suitable length of heat shrink tubing and shove it over the end of the fraying shoelace.
  4. Apply heat with a heat gun and you are done!

Booting the Asus R556LA laptop from USB

UEFI makes it harder, but not impossible to boot your PC or laptop from USB:

  • Shut down Windows and wait until all status lights on the laptop are out.
  • Press the power button and press f2 (without the fn button depressed) to get into the BIOS (Aptio Setup Utility)
  • If the laptop keeps on booting Windows and does not want to go into BIOS, try shutting it down with a long press (5 seconds) on the power button to shut it down and then power it up and press f2
  • Boot > Fast Boot: Disabled
  • Boot > Lauch CSM: Enabled
  • Security: Secure Boot menu > Secure Boot Control: Disabled
  • Save & Exit > Save Changes and Exit
  • Press f2 again
  • Boot > Boot Option Priorities > Boot Option #1: Generic Flash Disk
  • optional: Boot > Boot Option Priorities > Boot Option #2: Disabled
  • Save & Exit > Save Changes and Exit
  • The laptop should now boot from USB

20 Watt Class A Power Amplifier

In the nineties I built a class A power amplifier based on an article in the November 1985 edition of the Dutch electronics magazine Radio Bulletin. In 2000 I reproduced the article on my web site and added photos and extra schematics for a stabilized power supply for the preamp stage. Although some of the components are probably not available and the original website is long gone (archived on the WayBackMachine), I found it useful to repost the Dutch article: Klasse A-versterker van 20 Watt

Adding the SomaFM XBMC Plugin to OpenELEC

I am a huge fan of SomaFM. I Have been listening to this listener-supported, commercial-free Internet-only streaming music station for years.

I do no only use my xbmc on Raspberry Pi (OpenElec) to watch movies, I regularly listen to music as well. So how can we add the wonderful ambient, jazz, loungy or indie tunes of SomaFM to xbmc? A quick search pointed to https://github.com/nils-werner/xbmc-somafm, but my OpenELEC lacked the git command.

Reluctant to install git on OpenELEC just for this, I performed this workaround

  • I first installed git with the default package manager on my Linux Destop (Synaptic on Debian)
  • Following the instruction in https://github.com/nils-werner/xbmc-somafm/blob/master/README.md, I downloaded the plugin with git to my desktop:
    git clone https://github.com/nils-werner/xbmc-somafm.git plugin.audio.somafm
  • I then archived and compressed the folder:
    tar cvzf plugin.audio.somafm.tgz plugin.audio.somafm
  • Transfered the .tgz file to the OpenELEC:
    scp plugin.audio.somafm.tgz root@openelec:/storage/.xbmc/addons/
  • Then logged in with ssh to the OpenELEC, and extracted the .tgz:
    cd /storage/.xbmc/addons/
    tar xvzf plugin.audio.somafm.tgz
    rm plugin.audio.somafm.tgz
    chown -R root:root plugin.audio.somafm/
  • After rebooting your OpenELEC you can find SomaFM under Music > Add-ons

Happy listening!