Hevizibivaly Duathlon, a first-time experience

Last weekend I participated in a Duathlon for the first time, and an interesting one at that: Instead of a cycling stage you’ve got rowing! Every year on 1 March they kick off the spring season in Hévíz by paddling about 10km along a brook starting from the thermal springs and then running back the same way.

Hévíz, or termálvíz literally means thermal water and it’s also the name of the town Hévíz where you can find the lake Hévíz. I was surprised to learn this is the biggest thermal lake in Europe and the second biggest in the world. The name of the race is a play on words in Hungarian because depending on where you break it up it’s either Hévízi bivaly (buffalo from Hévíz) or Hé vízibivaly (hey, water buffalo!), as if you were shouting. Apparently they used to drive water buffalo along the brook to clear out the water weeds.

It seemed like a fun idea to do the race on a tandem SUP. We have a second-hand one that we use with the kids on the Danube in Summer and the race rules don’t forbid two people on the same SUP, although I did get a call from the race organisers to double-check I hadn’t made a mistake filling out the form. All I needed was a teammate. I invited/challenged our local parish priest, Father Attila, to team up for the race; he’s really sporty and seemed like someone who’d be up for the challenge.

Medal with yellow and black graphics resembling a water buffalo and Hungarian text reading: Hevizibivaly Duatlon, evezés, futás, 2025.03.01As the first day of (meteorological) spring after an icy cold winter, it was too cold to go out paddling until the day of the race, so we didn’t have any practice at all at paddling together, which made balancing and steering pretty challenging at first. On the day I ended up going barefoot as the thermal water was pleasantly warm and by the end of the paddling stage we got the synchronised paddling down to a T. The water was really shallow, apparently much shallower than usual, and twice I got knocked down into a kneeling stance when the board’s fin got caught in some weeds. We were the only 2-person team to use a SUP, the rest were in kayaks or canoes, and we ended up being lumped together with the “touring vessels”.

The running stage was particularly tough for me. I’m not really a runner and although I’d run 10k before a few times I didn’t consider I’d start it off tired from holding my body steady on a paddleboard for 2 hours. No problem for Father Attila who didn’t even break a sweat. Okay, it was only 6°C at max, but he also goes for regular runs and is much fitter than me in this regard. Luckily the emphasis of the race is more on fun and several people were even strolling along instead of running, so we didn’t fare too badly despite me being completely out of breath by the end.

All in all it was a great event, pushing quite far out of my comfort zone but with a chilled and fun atmosphere, people cheering each other on during the race and so on. It’s definitely worth trying at least once, even if you’re not a hardcore runner or rower. I met some friends during the race who participate every year and it got me thinking, maybe I’ll sign up next year too… maybe with a bit more practice in advance though. 😉

You can find out more about the race on the Hevizibivaly website or on the Hevizibivaly Facebook page.

FTR, these were the race stats I recorded to Strava/Garmin:
  

Counting digit occurrences in a range

I was asked if I knew an easy way to count how many times digits occur within a range of numbers. For example in the range 10–15, how many times does each digit occur? The numbers 0, 2, 3, 4 & 5 each occur once, and 1 occurs 6 times, that is twice in the number 11, and one in every other number in the range, because the tens all start with a 1. It seemed like an odd request, but it’s for number tags on utility poles, like this one:

There might be several rows of yellow tag numbers on a given utility pole

By Onore Baka Sama – Own work, Public Domain, source

Electricians use these tags to identify the poles and, at least in Hungary, they’re made up of individual plates for each digit, that are screwed on to a larger plate on the pole. If you estimate too few when ordering the digits you’ll run out obviously, and if you order too many you’ll be stuck with a pile of unused digits.

It seemed like a problem that should have a simple mathematical solution to it. Unfortunately, the answers I found on Math Overflow Continue reading

Custom thumbnail generators for audio waveforms and GIMP XCF files

I recently packaged these 3D thumbnailers for Arch Linux and this act inspired me to dig into this topic a bit and make some of my own. First off, what’s a “thumbnailer”? It related to this Free Desktop specification and I’d summarise it as:

A thumbnailer is a program that can generate a small preview image (called “thumbnail”) of a specific file type. File browsers know about thumbnailers by reading configuration from .thumbnailer files which specify which program to call for a specific MIME type, and which arguments to use to get the desired output.

For more details and practical examples of what these files look like and what you can do with them, see this blog post by Radu Zaharia. For most of the 3D thumbnailers I packaged, the thumbnailer programs are small purpose-built scripts, written in Python or Bash, that understand the specified format and how to get a PNG image out of it. The thumbnailer config just specified which order it wants its file input and output arguments in. However, as Radu’s blog post points out these can also be more advanced one-liners using programs you already have installed, so I decided to try that out and this post I’ll cover 2 such examples: Audio & GIMP.

tl;dr: Copy-pastable version at the end of the post Continue reading

Getting Xcape functionality in Wayland

The thing I’ve missed most since switching to Wayland is definitely Xcape, but more on that later. The solution is to use the Interception Tools plugin caps2esc and in fact this is a display-server agnostic solution because it’s at a much lower level, so it also works for X11 and even in the virtual consoles! 😮

Luckily Arch Linux actually has this plugin in the official package repos, so installation is easy:

$ pacman -S interception-caps2esc

This also installs interception-tools as a dependency, including udevmon which is a program that associates a job with any current and new devices (e.g. keyboards). In our case the “job” we want is a shell script piping intercepted keyboard output through the caps2esc plugin.

To do this, you copy this snippet, literally as-is from the plugin README file:

- JOB: intercept -g $DEVNODE | caps2esc | uinput -d $DEVNODE
  DEVICE:
    EVENTS:
      EV_KEY: [KEY_CAPSLOCK, KEY_ESC]

Paste that into a new file under udevmon.d, for example /etc/interception/udevmon.d/caps2esc.yaml to associate this plugin with the CapsLock and Esc keys on all devices.

Lastly, start up the udevmon service. Despite the README talking about running commands manually, the Arch Linux package includes a systemd unit file with the recommend defaults pre-configured, you just need to turn it on:

sudo systemctl enable --now udevmon.service

That’s it! Now Esc and CapsLock are swapped and holding down Esc functions as Ctlr, in Wayland, in X and even in the TTY!!!


So… why did I want to do this? Well, the caps2esc project documentation says it best:

transforming the most useless key ever in the most useful one

I spend a lot of my computer-time editing code and text in Vim where the Esc key is really frequently used because it’s how you change to “normal mode”. Lots of other programs also let you use Escape to do things like dismissing windows or stepping out of form fields. In GNOME settings there’s an option to swap the CapsLock and Escape keys and that made it a much smaller reach to get the Esc key with my pinky.

Reading up a bit more on this I stumbled upon Xcape which lets you set up CapsLock so that it’ll send Esc if you press it briefly, but act as Ctrl if you hold it down together with other keys. Amazing. The Control key is another annoying pinky-reach and its position varies between my work and personal computers. It’s used in loads of keyboard shortcuts across all apps, and it’s part of most key combinations in readline shortcuts used in the shell. As a power user, having both this and Escape close at hand on this really big, easy-to-hit CapsLock key in the home row is fantastic! Until I switched to macOS.

The old work laptop got replaced with a newer MacBook that brought exciting new hardware compatibility issues. In this case, the built-in keyboard refused to work at all, and after a few weekends of trying to fix it I gave up and accepted the challenge of using the other OS. I was happy to learn this dual Ctrl-Esc functionality was something Mac users were after too and using Karabiner-Elements I was able to set this up pretty easily, as well as the compose key. I ended up using this for a several years and it worked well. I might write a bit about my personal experiences with macOS compared to Linux at some point but eventually this laptop got old too and the next machine was Linux-compatible.

Meanwhile in Linux-land support for Wayland is stable with GNOME desktop and so I switched from X11 to Wayland to get better scaling between the laptop’s HiDPI screen and the HD external monitor. The issue of being able to share my desktop got fixed upstream but the last thing I was missing from X11 was some alternative to Xcape. The X in Xcape alludes to X11, and if an X server isn’t running Xcape can’t start and anyway there wouldn’t be any X input events to handle without X. Pretty annoying. I tolerated this for about a year because the solutions I found looked a bit less out-of-the box than Xcape and I didn’t want to spend so much time tweaking a computer. Xcape issue #67 wayland support lists some alternatives, ranging between pretty hacky to “just use X”.

It was in this list that I came across caps2esc, bookmarked it for later, and later is today. I’ll be honest, I struggled a bit to make heads or tails of the Interception Tools documentation. On one hand it seems the way to write custom “plugin” functionality was written in C, and the code looked short and readable enough, but on the other hand it’s talking about configuring things with YAML files. The YAML config didn’t seem to be input to the plugin itself though. After some back-and-forth between the main docs and the plugin docs it became obvious: The plugin itself is written in C. If you have it installed, you can use the interception tools intercept and udevmon to send keyboard events through the caps2esc plugin. Using udevmon you can configure to which devices to apply this rule (called a job) and the way to do that is to write some udevmon config in YAML. The puzzle pieces all fit together and the result is the condensed set of instructions at the top of this post.