~derf

Hi!

This is the personal homepage of Daniel Friesel / derf / derfnull (depending on context and nickname availability). Every now and then, I write software and take pictures, which you can find here. There's also some hosted services.

Services

genregenerator.de
Provides random music genres
Listen to Symphonic Punk

Projects

Software

App::Raps2 v0.54
CLI password safe
Travel::Routing::DE::VRR v2.17
Interface to EFA-based itinerary services
> efa Essen Martinstr Düsseldorf Hbf
14:34 ab  Essen Martinstr.: Bstg. 1      Straßenbahn 108      Essen Altenessen Bf Schleife
14:38 an  Essen Hauptbahnhof: Bstg. 1

14:47 ab  Essen Hauptbahnhof: 2          R-Bahn RE11 (RRX)    Düsseldorf Hbf
15:24 an  Düsseldorf Hbf: 10
Travel::Status::DE::DBWagenreihung v0.02
Interface to Deutsche Bahn Wagon Order API
> db-wagenreihung 'Essen Hbf' 723
▏      G       ▕▏    F    ▕▏    E     ▕▏   D    ▕▏    C    ▕▏    B    ▕▏             A             ▕
     >  39   38    37   36   35   33   32   31    29   28   27   26   25    23   22   21 >
Travel::Status::DE::DeutscheBahn v2.04
Interface to HAFAS-based arrival/departure monitors
> hafas-m 'Messegelände, Leipzig'
14:32    STR   16  Lößnig, Leipzig
14:40    STR   16  Sportforum Süd, Leipzig
14:43    ALT   86  S-Bahnhof Messe, Leipzig
14:47    STR   16  Lößnig, Leipzig
> db-iris 'Dortmund Hbf'
14:38 +16  IC 2027     Passau Hbf            11
14:39      ABR RE11    Kassel-Wilhelmshöhe   8
14:41      RE 57       Winterberg(Westf)     2
└────      RE 57       Brilon Wald           2
14:41      S 5         Hagen Hbf             5
14:42      S 2         Dortmund Hbf          6
14:45 +1   RE 1        Aachen Hbf            16
> ura-m Talbot
14:49:41  52    Aachen Bushof
15:04:47  11    Lichtenbusch
15:05:00  52    Eschweiler Bushof
15:18:00  1     Aachen Bushof
15:19:56  11    Hoengen Markt
15:35:00  1     Schevenhütte
Travel::Status::DE::VRR v1.15
Interface to EFA-based departure monitors
> efa-m Dortmund 'Universität S'
08:32  +1  02  445    Dortmund Am Kai
08:35      3   HB1    Dortmund Technologiezentrum
08:36      3   HB1    Dortmund Eichlinghofen H-Bahn
08:38      02  447    Dortmund Bandelstraße
08:39      2   S1     Dortmund Hbf
08:40      01  447    Dortmund Hacheney
> ct a mutt
mutt: retrieving package
Cloning into 'mutt'...
[..]
created   .muttrc         -> /home/derf/packages/mutt/etc/muttrc
> ekgping ccc.de
__________^________^__________^________^______

Firmware and Hardware

MicroMoody
I²C moodlight
TODO!
VUSB-I²C v0.02
USB ↔ I²C adapter

Obsolete

These projects are neither developed nor maintained any more. Some do offer basic functionality, though.

App::Slackeria v0.12
Project status overview

News

Travel-Status-DE-IRIS-1.32.tar.gz (signature)

  • Travel::Status::DE::IRIS::Stations: Add geocoordinates fo some swiss and austrian stations

Travel-Status-DE-IRIS-1.31.tar.gz (signature)

  • Travel::Status::DE::IRIS::Stations: Add EVA/UIC station numbers and use full names for non-german stations.

Travel-Status-DE-IRIS-1.30.tar.gz (signature)

  • Result: Add ->station and ->station_uic accessors. These are useful to determine which station an individual train belongs to when requesting departures of multiple stations at once using the with_related option.

Travel-Status-DE-IRIS-1.29.tar.gz (signature)

  • Add QoS code 72 (no info/entertainment system available)
  • Fix erroneous QoS codes 83, 91, 92

Travel-Status-DE-IRIS-1.28.tar.gz (signature)

  • Add 234 stations missing from regular DB Open Data station list
  • Add delay code 14 (Technische Störung am Bahnhof)

Travel-Status-DE-IRIS-1.27.tar.gz (signature)

  • Add station Berlin Zoologischer Garten (S)

Travel-Status-DE-DBWagenreihung-0.01.tar.gz (signature)

  • Initial release. wagen order and wagon type information for a specific train at a specific station. Documentation is incomplete, API may change without notice.

Travel-Status-DE-IRIS-1.26.tar.gz (signature)

  • Fix DS100 code for Berlin Westkreuz
  • Add station Bonn UN Campus

Travel-Status-DE-IRIS-1.25.tar.gz (signature)

  • Do not ignore trains with arrival < lookahead, even if departure >= lookahead.
  • Add delay code 66 (flooded area)

Travel-Status-DE-IRIS-1.24.tar.gz (signature)

  • Remove erroneous double entry for Düsseldorf-Bilk
  • Fix a warning when encountering unusual train types

Travel-Status-DE-DeutscheBahn-2.04.tar.gz (signature)

  • Handle invalid XML when using the VBB backend

Travel-Status-DE-IRIS-1.23.tar.gz (signature)

  • Ignore apparently useless "ZOB" (central omnibus station) links at most main stations. This decreases the average runtime and also fixes some S-Bahn trains being reported twice in München Hbf.
  • Result->qos_messages: Skip superseded messages. They're still present in ->messages.
  • Result->route_interesting: Filter Hbf suffixes (not just "Hbf"); include .hl.n (czech main station).

Travel-Status-DE-IRIS-1.22.tar.gz (signature)

  • Add delay code 4 (unforeseen staff shortage, thanks to Fabian Schwarz)
  • Add delay code 37 (technical failure in carriage, thanks to @marudor)

To increase flash lifetime and avoid problems with unexpected power cuts, I run all of my embedded Linux systems from a readonly root filesystem. This is a moving target: Depending on the software in use as well as the version and configuration of systemd and userland software, different adjustments may be needed.

I have created a readonly linux reference page containing all tweaks I know of at the moment, which are mostly tmpfs mounts and /etc/tmpfiles.d entries. I'll update it when I run by something new.

Preseeding is a handy way of automating Debian installations. With a proper preseed.cfg, a Debian installation can run completely unattended in about 10 minutes, including setup of users, sudo and SSH keys.

For future reference, here are the things I found helpful

custom post-installation commands

d-i preseed/late_command executes arbitrary commands after the installation is completed. I use this to set up SSH keys and sudo, like so:

in-target mkdir -p /root/.ssh /home/derf/.ssh; \
in-target wget -O /root/.ssh/authorized_keys https://.../keys-root; \
in-target wget -O /home/derf/.ssh/authorized_keys https://.../keys; \
in-target chmod 700 /root/.ssh /home/derf/.ssh; \
in-target chmod 600 /root/.ssh/authorized_keys /home/derf/.ssh/authorized_keys; \
in-target chown -R derf:derf /home/derf/.ssh; \
apt-install sudo; in-target adduser derf sudo

Adding preseed.cfg to virt-install images

--initrd-inject embeds arbitrary files into the root of the installation image. So, for preseeding, just add --initrd-inject .../preseed.cfg to your virt-install invocation.

Adding preseed.cfg to USB images (with UEFI support)

This is a bit more tricky. Basically: Download and unpack ISO, inject preseed.cfg into initrd, refresh md5sums, rebuild ISO and add UEFI support.

The following script should do the job for most amd64 systems. Usage: ./mkpreseediso debian-x.y.z-amd64-netinst.iso

#!/bin/sh

set -e

ISO="$1"
WD="$(mktemp -d)"

7z x -o$WD $ISO

cd $WD

gunzip install.amd/initrd.gz
cp /tmp/preseed.cfg .
echo preseed.cfg | cpio -o -H newc -A -F install.amd/initrd
rm preseed.cfg
gzip install.amd/initrd

find -follow -type f -print0 | xargs --null md5sum > md5sum.txt

cd

xorriso -as mkisofs -o $ISO -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
-c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 \
-boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot \
-isohybrid-gpt-basdat $WD

Travel-Status-DE-IRIS-1.21.tar.gz (signature)

  • Fix crash when receiving invalid XML due to network issues

findmnt --raw --noheadings --output options --target SOME_DIRECTORY | grep -qE '(^|,)ro($|,)'

  • findmnt is a handy alternative to mount when writing scripts
  • SOME_DIRECTORY does not have to correspond to a mountpoint. If it doesn't, findmnt will traverse its parent directories until it finds the corresponding filesystem / mountpoint.
  • a simple grep ro would also match options like errors=remount-ro, so we make sure to only match the single ro option. It must be delimited by commas or the start/end of the option string.

Travel-Status-DE-IRIS-1.20.tar.gz (signature)

  • Use schedule instead of realtime data when determining whether a train falls within the lookahead time frame. This fixes severely delayed trains being ignored even if their scheduled arrival/departure is very soon or has already passed.

Travel-Status-DE-IRIS-1.19.tar.gz (signature)

  • db-iris: Fix -ot ignoring arrival delay if departure is on time
  • Add delay code 12 (waiting for passengers in a ship)
  • Result->route_interesting: Include dutch and swiss central station names
  • Result: New accessors arrival_delay and departure_delay