You may or may not find something useful here.

Browse the archive too see all entries.

use nodm instead lightdm for kodi

The official kodi wiki suggests using lightdm with the autologin enabled in order to autostart kodi. But there is a problem with this approach: If kodi crashes (which it frequently does), you are greeted with the login screen instead of having kodi restart.

What you would need is a kiosk mode for lightdm - which is awefully heavy in configuration - at least in comparison with nodm:

  • Simply apt install nodm
  • then edit /etc/default/nodm and change NODM_USER=root for NODM_USER=kodi (or whatever kodi user you have)

Then, enable autostarting for the user:

$ mkdir -p ~/.config/autostart && ln -s /usr/bin/kodi ~/.config/autostart

Posted Mon Jan 6 12:05:57 2020
get local time via wifi

If you travel, you will probably have the problem that the time on your laptop is still the home time. On mobile phones, the time will automagically be retrieved from the mobile network time, but if you do not have a mobile connection on your laptop, this is quite hard. But there is a trick you can do, which requires the use of geoip-bin.

Just lookup your public wifi IP and compare it to the geoip database:

TZ=$(geoiplookup $(curl -s | cut -d " " -f 4 | tr -d ',') date

With a little bit of scripting, you can put this into a nice script, which will refresh the cache of the local timezone every hour.

# this script tries to get the local time by checking the public wifi IP

if ! [ -f ~/.cache/localtime.cache ] || [ $(($(date +%s) - $(stat --printf '%Y' ~/.cache/localtime.cache))) -gt 3600 ] ; then
    geoiplookup $(curl -s | cut -d " " -f 4 | tr -d ',' > ~/.cache/localtime.cache
    if [ $? -ne 0 ]; then
        exit 1

if [ -z "$1" ]; then

if [ -f ~/.cache/localtime.cache ]; then
    TZ=$(cat ~/.cache/localtime.cache) date +"$FMT"
    date +"$FMT"

Later I found out, that this script does only work, if the country you are in, is listed as an own timezone in /usr/share/zoneinfo. It is the case for GB but for example not for AT. There are some conversion lists, but you will obviously get problems when you are in the US or Russia, as those countries span multiple timezones. So yeah, this script kind of work in some cases only. But I hope you get the point and can adjust it to your needs!

Posted Thu Oct 3 10:03:31 2019
building a proper gopro charger

Years ago, I bought some third party dual GoPro charger off amazon.

The first thing I did, was take it apart... It was very heavy and I was interested what I would find inside. To my surprise, most of the weight came from an steel piece, which was put inside the case. It looks like it was deliberatly put there to keep the charger from flying around or to give it a "proper feel". I don't know...

The charging circuit was also quite interesting. It only consists of the reference circuit to an UN8HX charger - which is a cheap 4.2V lithium charger IC with 500mA charging current, which was very easy to reverse engineer.

One funny thing though was that the two charging ports were connected in parallel to the charger. In my opinion this is not very good for LiPo batteries, especially if you try to charge to cells which have different charging levels.

At some day, the charger stopped working - I'm not sure why and I do not want to know... I bought some cheap LiPo charger circuits of amazon, in my case some boards which use a TC4056A (a 4.2V/1A lithium charger IC). After some sawing and glueing, I ended up with a much much smaller and better charger:

I also added a small spring on the side, as the charge pod size would not properly fit the batteries, hence they would fall out of the charger if used.

The charger works much faster than the original one (the original knock-off one). The biggest advantage though is the size: The old charger was quite clunky and much bigger than the GoPro itself.

(I know, the sawing is a little bit nasty and the thing does not look nice... I promise I'll 3d-print a proper case if I ever have time to do it ;))

Posted Tue Jun 25 21:15:44 2019
Rant: Java versions in Debian

I need to run JabRef on my debian machine. But suddenly, it stopped working! After a little bit of searching, I found out that openjfx was lately upgraded to version 11+26-5. Nice! So finally it can be used with Java 11!

But wait... JabRef can only run with Java 8. But uhmmm that means I need the openjfx for Java 8 as well?!

Using confirmed that theory. Downgrading the packages of openjfx to 8u171-b11-2 made JabRef working again... Yeah, but then openjfx does not work with other versions than 11.

On the debian issue tracker you can find this bug: Debian bug #910407. There you can read:

openjdk-8 is still there because we haven't completed the transition to
Java 11 yet. It may remain in Buster but only as a build dependency,
there is no plan to support it at runtime. Java based applications in
Buster must run on Java 11 (it should soon become the default JRE).

For these reasons packaging openjfx-8 doesn't really make sense. That
would be a string preventing us from moving forward.

Uhmmmm, so that means Java 8 is basically out of order soon, but there are still very useful tools using it. Why is it so hard to create different versions of openjfx to work with each java version? What is even weirder about the openjfx package, is that it does not pin the versions of the dependand packages and also does not specify the required java version:

Package: openjfx
Version: 11+26-5
Priority: optional
Section: java
Maintainer: Debian Java Maintainers <>
Installed-Size: 30,7 kB
Depends: libopenjfx-java
Recommends: openjfx-source
Download-Size: 8.848 B
APT-Sources: testing/main amd64 Packages
Description: JavaFX/OpenJFX - Rich client application platform for Java
 JavaFX/OpenJFX is a set of graphics and media APIs that enables Java developers
 to design, create, test, debug, and deploy rich client applications that
 operate consistently across diverse platforms.

Package: openjfx
Version: 8u171-b11-2
Priority: optional
Section: java
Maintainer: Debian Java Maintainers <>
Installed-Size: 77,8 kB
Depends: libopenjfx-java, openjdk-8-jre
Download-Size: 35,8 kB
APT-Manual-Installed: yes
APT-Sources: unstable/main amd64 Packages
Description: JavaFX/OpenJFX 8 - Rich client application platform for Java
 JavaFX/OpenJFX is a set of graphics and media APIs that enables Java developers
 to design, create, test, debug, and deploy rich client applications that
 operate consistently across diverse platforms.

From that alone, I thought that openjfx 11 would work with the old versions just fine. But no, it does not.

That means I need to run JabRef in a VM soon, in order to make it work... Nice!

Posted Mon Nov 19 12:36:36 2018
the science of boiling eggs

There is a very interesting article in German on boiling eggs from one of the Science Busters Werner Gruber: Wie lange kocht man ein 3-Minuten Ei?.

This article gives an equation how long an egg must boil for a certain core temperature to reach:

t = 0.0016 \cdot d^2 \cdot \mathrm{ln}\left(\frac{2 \cdot(T_{\mathrm{water}} - T_{\mathrm{start}})}{T_{\mathrm{water}} - T_{\mathrm{inner}}}\right)

For a soft-boiled egg, the value of T_{\mathrm{inner}} should be above 61.5°C but below 65°C. The article specifies 62°C as the target but another page, which is citing this article gives 64°C as the target value. We use this higher value here.

As T_{\mathrm{water}} can be set to 100°C and T_{\mathrm{start}} can be assumed to be 4°C, if the egg comes from the freezer, the whole equation can also be written as:

t = 0.002678 \cdot d^2

A normal egg has a minor diameter of about 41mm (S) to 49mm (XL). Plotting the function between these values, we can see, that the curve is almost linear in this region. The linear function can be calculated as:

t \approx 0.24 \cdot d - 5.36

Thus, to have an "in the ballpark" figure for the boiling time, just take a quarter of the minor diameter and subtract 5 and a half minutes from the result and take the eggs out a little bit earlier ;)

Posted Tue Oct 9 15:50:32 2018
fixing a hario scale

After a capuccino spill over a Hario VSTM-2000 scale, the timer was frozen and the buttons would not work anymore.

Also plugging in the USB would not work, the scale charged but did not reset. As the batteries are not removeable (at least not easily), I opened up the scale.

First you need to remove the rubber feet and remove the screws. There are also two more screews in the middle:

Now you open up the small lid, which has two more screews under it:

If you remove those two, the whole scale should come apart. You could have removed the scale plate before (I did not knew it was removeable), then it is much easier to separate the two halfes.

Here are a few impressions. First of all the load cell with it's four wire measurement:

Now the display and button module:

The USB charging module:

and the battery:

To reset the scale, I shorted the battery for a very short amount of time. It was enough to have the microcontroller reboot. I also cleaned the scale, as it had some milk in it. After that you can put everything back together. Make sure not to pinch the wires.

Posted Sat Jul 14 16:52:10 2018
nexus5 charging

You ever wanted to monitor the charging of your Nexus 5 from the commandline? Here is how it works.

The Nexus 5 uses two chips to control the charging:

While the first chip controls the maximum current which is drawn from the USB, the second chip monitors the current charging current.

Both chips can be read over their I2C interface:

$ ls -al /sys/bus/i2c/drivers/max17048
total 0
drwxr-xr-x  2 root root    0 2018-06-27 21:03 .
drwxr-xr-x 17 root root    0 2018-06-27 20:58 ..
lrwxrwxrwx  1 root root    0 2018-06-27 21:03 84-0036 -> ../../../../devices/f9923000.i2c/i2c-84/84-0036
--w-------  1 root root 4096 2018-06-27 21:03 bind
--w-------  1 root root 4096 2018-06-27 21:03 uevent
--w-------  1 root root 4096 2018-06-27 21:03 unbind

$ ls -al /sys/bus/i2c/drivers/bq24192/
total 0
drwxr-xr-x  2 root root    0 2018-06-27 20:58 .
drwxr-xr-x 17 root root    0 2018-06-27 20:58 ..
lrwxrwxrwx  1 root root    0 2018-06-27 20:58 84-006b -> ../../../../devices/f9923000.i2c/i2c-84/84-006b
--w-------  1 root root 4096 2018-06-27 20:58 bind
--w-------  1 root root 4096 2018-06-27 20:58 uevent
--w-------  1 root root 4096 2018-06-27 20:58 unbind

To get the current current, you can do the following:

$ cat /sys/bus/i2c/drivers/max17048/84-0036/power_supply/battery/uevent

or while charging:

$ cat /sys/bus/i2c/drivers/max17048/84-0036/power_supply/battery/uevent
Posted Wed Jun 27 21:22:29 2018
make your own finger tab

I used very cheap leather tabs for shooting recurve bow. I think the biggest disadvantage of them is the hole where your middle finger should fit through. It bends around the finger and the tab likes to entangle itself, thus will constantly try to avoid laying onto your fingers. Someone of our club suggested other finger tabs, which have a small strap attached to them, which is worn like a ring. I think the majority of finger tabs uses this technique, but they are sometimes quite expensive - especially if you want them with special abilities like a chin rest or adjustable plates.

In our club I saw one guy with a felt tab - I'm not sure where he got this from because I can not find a single shop selling those... He said that he finds the felt type the most comfortable to use. So I thought, I would give felt a try!

From a recent project, I had some 3mm felt with 0.36 density. I cut off a rectangular piece about 70 by 60 mm and reused the finger separator from my old tab.

Then I cut a small strap of leather and sewed it on one end to the felt. I figured out, that a small hole is already sufficient, but it will probably loosen itself over time.

The other end I just put through the same hole as the separator.

I also cut a larger slot between index and middle finger and just a single cut between middle and ring finger. I think this gives you a little bit more flexibility, but you might decide to leave it as it is.

Today I tried the tab and I in my oppinion it works great. You can feel the bowstring much better - which might be painful to you (I think it is just right).

When you make your own, here is a good advice: You probably want to cut the tab to size directly at the shooting range. Never cut off large pieces, as your fingers are very sensitive already for small pieces! So what you feel might might be a huge chunk of material but in reality it is just a milimetre. I made this mistake when cutting to length my old tab. I thought that I would need to remove much material which wasnt the case.

For the future, I might create a new one with a aluminium plate attached. You should also think about a better mechanism to hold the strap, because it will loosen over time. I think the easiest way would be to create small metal plate, which secures the leather strap.

Posted Mon Mar 12 18:44:28 2018
get every nth day of month in the year

Here is a short script to get the nth day in the month for the whole year, e.g. every fourth thursday:

for month in $(seq -w 01 12); do ncal -M $month 2018 | grep Do | awk -v var="$month" '{ print "2018-" var "-" $5 }'

you need to adopt to your locale...

Posted Thu Feb 8 20:57:14 2018
track disk writes

On a system which has de-facto nothing to do (a router basically), I observed constant disk writes with collectd:

As you can see, in 12h alone there was a total write of 3.2GB to the disk.

Using lsof, I could identify all opened files in write mode:

diff <(lsof | awk 'NR==1 || $4~/[0-9]+[uw]/ && $5~/REG/ && $6~/8,1/') <(sleep 30; lsof | awk 'NR==1 || $4~/[0-9]+[uw]/ && $5~/REG/ && $6~/8,1/')

I know that my only physical disk in the system is 8.1, regular files are denoted by REG and write condition is either a w or a u. The SIZE/OFF column gives you some feeling of how many bytes are written in the last 30 seconds.

The output looks like this

< rsyslogd    509             root    6w      REG                8,1  3936622     785024 /var/log/syslog
> rsyslogd    509             root    6w      REG                8,1  3937650     785024 /var/log/syslog
< rsyslogd    509             root   12w      REG                8,1  1636869     786638 /var/log/daemon.log
> rsyslogd    509             root   12w      REG                8,1  1637897     786638 /var/log/daemon.log

clearly something was logging to the logs constantly. After watching the logs for a moment I could identify the problem and resolve it.

But I still could not identify the real cause. The log messages had some influence but where not the root cause.

Here comes iotop to the rescue. Start with

iotop -a -o

to see only active processes and accumulate. Let this run some minutes.

I could find a process which would write files every so often, but would not keep them open. Thus they would fall through the search with lsof!

Posted Tue Jan 23 06:54:17 2018