Simple bash script to prepare images for the web

By Andreas Wilhelm Oct 25, 2015

A few days ago i reactivated my blog and decided to switch from Wordpress to Jekyll. After I had solved most problems regarding the migration, I had to think about my new publishing process and the major issue I had to face was the preparation of my images. Wordpress scaled my images and reduced the image quality for me, now I have to do this on my own.

To do this, I have written a small script that checks the width and height of a given image and scales it down and reduces its quality. This script internally uses two commands of the ImageMagick software suite, the identify and convert command. While identify allows me to collect all important information about a given image, convert enables me to convert the image to another image format, scale the image and reduce the image quality.

Load .Xresources when using GDM in Arch Linux

By Andreas Wilhelm Oct 16, 2015

A few days ago I faced some issues with lightdm after upgrading my system. A quick fix was to switch to GDM. However, after switching to GDM my .Xresources wasn’t load at boot. A quick look into /etc/gdm and I found the Xsession configuration file, which included the following code:

if [ -f "$userresources" ]; then
  xrdb -nocpp -merge "$userresources"
fi

xrdb Manual: -nocpp This option indicates that xrdb should not run the input file through a preprocessor before loading it into properties.

This means that my .Xresources configuration was loaded, but the includes were not executed because no preprocessor was used. So the GDM maintainers hoped to improve performance by using the -nocpp flag. So to fix this issue I just had to remove the flag and my XTerm styles were loaded.

Hope this will help you. Until next time: Stay geeky!

Using Font Awesome in QML applications

By Andreas Wilhelm Oct 1, 2015

Today I was wondering if I could use Font Awesome with Qt’s QML to add some nice looking icons to my buttons. A quick google search brought up an article “Using Fonts Awesome in QML” by markg85 at Mark’s KDE Blog. Mark came up with a nice solution that uses a javascript dictionary to store the icon names with their corresponding unicode character:

var Icon = {
    Glass               : "\uf000",
    Music               : "\uf001",
    ...
};

However, this has two problems.

  1. The names in the javascript file do not match the definitions on fontawesome.github.io.
  2. The defintions are outdated and do neither include the latest icons nor alias names.

Funny Fact: It’s actually fortawesome.github.io not fontawesome.github.io.

Cubify - The Inkscape Plugin for creating Cheat Cubes

By Andreas Wilhelm Sep 21, 2014

Raspberry Pi Cheat Cube

I love cheat sheets. A good cheat sheet decorates your desk and presents its content in a simple and understandable way. And a perfect cheat sheet presents its content also in an entertaining way and is called Cheat Cube. Cheat Cubes are awesome. It decorates your desk and serves as a toy, while waiting for a download to end, a game to load or a compiler to finish its process. And as a pleasant side effect, you learn some new stuff, you can benefit from in your daily life.

However, I was looking for a weekend project and decided to write my first Inkscape Plugin that simplifies the creation of Cheat Cubes and I ended up with Cubify.

Home automation - RaspberryPi, FHEM and Arch Linux

By Andreas Wilhelm Aug 17, 2014

Once upon a time, there was a computer science student blogging about all that stuff that comes to his mind … Yeah, it has been about a year since my last blog post and I apologize for that. However, I would like to share some experiences with you that I gathered during one of my projects, namely home automation using the Raspberry Pi.

In this post I will show you how you can setup the GPL’d perl server for house automation, fhem, on your Raspberry Pi or an other single board computer, like the Beaglebone (Black), Bananapi or Gooseberry, running the one and only Arch Linux distribution. Finally I will give an example of how you can use fhem to control HomeMatic or other home automation components. So lets get started with the Arch Linux setup.

Flashing Arch Linux to the Beaglebone, Beaglebone Black or Beaglebone Black eMMC

By Andreas Wilhelm Oct 13, 2013

At the beginning of my studies at the university of Göttingen I was very interested in micro electronics. From this period I still own numerous electronic components like LCDs, GPS receivers, many different sensors and a camera module. While accessing the GPIOs of the Beaglebone in order to light an LED or to request the value of a sensor is pretty easy, accessing a camera modul or a LC Display is not that simple. That means, that I have been consistently concerned with the different interfaces of the Beaglebone Black during the last few weeks. Meanwhile I freshed up my knowledge about the Qt development suit, the OpenCV computer vision library and different C/C++ libraries that are used to controller camera modules or LC Displays.

Concatenating images to one PDF file in Linux

By Andreas Wilhelm Oct 4, 2013

A while back, I showed you how you can convert gif animations to mpq files using ImageMagick. And you can do even more with ImageMagic, like converting between various image formats, resizing an image or even drawing a new one.

However, last week I started to setup Arch Linux on my desktop and I faced some problems while trying to get the cups PDF printer up and running. Thus, I was not able to export my pen and paper character to a PDF file, which I could then send to my tablet in order to take it to the games evening with my friends that night. Fortunately, there exists this great tool, ImageMagic. It is not only able to convert from one image format to another using the convert command, but also to concatenate several images to one single PDF file.

Install ADB and Fastboot under Linux

By Andreas Wilhelm Aug 20, 2013

A few days ago I received my new HTC Desire C that I purchased on ebay for just a few coins. When I received it, it was flashed with the standard Android JellyBean (4.1.2).

Let’s get started. Most distributions have packages for ADB and Fastboot in their repositories, but because they are in most cases out-of-date, I recommend to install these tools by installing the Android SDK directly. So start downloading the latest Android SDL. During the download you should ensure that no system packages of ADB and Fastboot are already installed. Since I am running a Debian Wheezy on my desktop, I could remove such system packages by executing the following commands:

sudo apt-get purge android-tools-adb android-tools-fastboot

Using arp to list available host

By Andreas Wilhelm Jul 22, 2013

The last few days I was very busy and had no time to hang out or write a blog post. Nothing changed, I am still busy, but here are a few tips on how you could list all responding IP addresses within your network.

Today I had to figure out which IP address the DHCP server assigned to the weather station I connected to the internal network, so I could connect to it using the web interface of the station. Therefore I wrote a small bash script which receives a net address with the last number replaced with an asterisk:

#!/bin/bash
net=$1
available=0

for i in {1..254}
do
   host=`echo $net | sed 's/\*/'${i}'/g'`
   ping=`ping -c 1 $host | grep bytes | wc -l`

   if [ $ping -gt 1 ];then
      echo "$host is up!"
      available=$(($available + 1))
   fi
done

if [ "$available" -eq "0" ];then
   echo "No hosts in this net."
fi

Save this script to listHosts.sh. If you would like to list all hosts of the internal network 192.168.1.*, just enter the following line within your terminal:

./listHosts.sh 192.168.1.*

However, this will take some time and will either return a list of available host or prompt “No hosts in this net.”. A much faster way to do this is using the arp command:

arp -a | grep 192.168.1

This will display all reachable hosts with the prefix of your net in the alternative (BSD) style.

Hope this will help someone. Until next time - Happy scripting!

Automated PDF reports using ReportLab, z3c.rml and Preppy

By Andreas Wilhelm Jun 12, 2013

The generation of reports is part of the daily business for everybody, who participates in a development or research team or works as part of a sales force team. You always have to report your current project state, your latest updates and fixes or the sales and order intake of the last quarter as well as the forecast of the coming quarter. Most of this reports always consist of the same graphs, texts and forms and could therefore be generated using something like a template. In other words they could be generated completely automatically if the data that changes over time is stored in something like a database.

Imagine a smaller web shop you are running. To get a better feeling of whether the shop is profitable or not or to check the response to a marketing campaign, you have to monitor your business. Thus, a report that contains some statistics about the evolution of your daily and/or monthly sales, as well as the analysis of the targets defined in the forecast, could help you to improve your marketing strategy.

However, I am a computer scientist and do not care about those stuff, but I am the one to ask how to automate things. And that is what I did to monitor different things, like my Flattr and Wordpress account, as well as the monthly power consumption of different house electronics at home. The range of applications is enormous, if you just think about it for a moment.


is a Computer Science MSc. interested in hardware hacking, embedded Linux, compilers, etc.