Stop the war!

Stop the war in Ukraine! Fuck putin!

More information is at:

There is a fund to support the Ukrainian Army:, and there is a special bank account that accepts funds in multiple currencies: I donated to them. Please donate if you can!

Killer putin

Killer putin. Source:

Arrested putin

"It hasn't happened yet, but it will happen sooner or later. Beautiful photo, isn't it?" Source: twitter.

Open-sourcing kitya scripts

| comments

I’ve published an extremely niche, small project on github today: The repository contains a few scripts and a readme to create epubs out of Kitya Karlson’s blog (in Russian). I won’t repeat the readme here.

Why have I open-sourced it? I think it may be a useful example (primarily for myself) of using the Haskell XML Toolbox (HXT) to process XML in Haskell and generating automated screenshots of webpages. HXT is mind-bendingly cool and unusual, as it uses arrows to process the parsed XML tree; it takes a while to figure out what’s going on, but then it’s relatively easy to use the provided combinators to do whatever you need with XML/HTML.

Using neovide/vimr as comfort0 editors in JOSM

| comments

Comfort0 is a useful plugin for fast editing of OSM features, where you edit a text file in the Level0L format. The issue was that I didn’t have any of the default text editors installed, so I tried to use neovim-based GUIs: Neovide or VimR. Both can be brew install‘ed and have CLI launchers, but neither one worked. JOSM showed a popup saying Launching editor on file /tmp/…/josm_level0_….txt, the editor was indeed launched, but always showed an empty file (ls confirmed that). So in cases when I needed to have manual, controlled mass-edits, I used to copy the Level0L code (there is a menu item for that), paste it into vim, use macros to edit the information, copy that and paste as Level0L code into JOSM. This worked fine, even if it was clunky. I decided to debug the issue.

A postal code encoding question

| comments

USSR used a fixed stencil to write postal codes on mail envelopes. It’s similar to a seven-segment display, but had 9 segments with a standard way to write all 10 digits:

I stumbled upon an article (in Russian) claiming, and confirming, that only 4 of the 9 segments are enough to distinguish all 10 digits. The article had a small challenge to write a program to find out the number of different ways to pick 4 segments that allow to distinguish all the digits. It’s a small, yet interesting problem to solve; my program is in Haskell and is available at

Details about a Haskell puzzle

| comments

I’ve seen this “Haskell Puzzles” page on Haskell Weekly and decided to see what it was about. It has puzzles where you need to rearrange the given tokens so that the final expression produces the needed value.

The first puzzle was easy, and the second one… was hard. The tokens are iterate ) 5 join !! 1 ( (+) with the goal value of 32. The puzzle also says: “What Monad are we looking for?”. I thought, of course, [] since we have join and !!. I also saw that 5 and 32 were most likely related: 2^5 = 32, but I couldn’t see a way of generating powers of two here.

How to split a line into equal segments in JOSM

| comments

Task: map a line of bollard nodes separating one-way directions of a road. You can certainly map them as a way w/o individual bollards as nodes. If you know the number, I think it’s worth it to map them individually; in my case, the line is straight and there are 12 bollards, with an equal distance between each pair. The challenge is to map them with the correct distance, and the solution is to use the terracer plugin.

Install the plugin first. I’ll show the process for an imagined road:

TIL about brace expansion with extra text

| comments

I knew about this neat shell expansion feature (very helpful for file selection):

$ echo {foo,ba{r,z}}
foo bar baz

Today I stumbled upon this stackoverflow answer containing the command (shortened here):

$ sudo rsync -avAX --delete --exclude={"/dev/*","/proc/*","/sys/*"} / /mnt/rootfs

I wondered how it would work since I thought it would expand to … --exclude="/dev/*" "/proc/*" "/sys/*" …, which wouldn’t exclude those other paths in rsync.

Reformatting old text books in vim

| comments

I’ve found a few old books from the 1990s, which are in the simple txt format. Since there is no explicit formatting possible, my PocketBook 740 Color e-reader formats the files not in the best way. Hard-wrapped paragraphs separated by empty lines are left-aligned and aren’t reflown in the reader, so a lot of space is wasted on the right. I couldn’t quickly find a program that would reformat such files; Calibre’s ebook converter didn’t do what I needed. In the end, I was able to cleanup such books in vim with a few commands.

The gfs program

| comments

I’ve open-sourced the first version of my tiny program gfs this week, at It’s a CLI filter program to implement the Grandfather-Father-Son cleanup scheme for backups. The first version has the minimally necessary features such as user-definable time format to parse all the input strings. More user information is in the README at; this post is about some history and technical details.