KISS 🇺🇦

Stop the war!

Stop the war in Ukraine! Fuck putin!

More information is at: https://war.ukraine.ua/.

There is a fund to support the Ukrainian Army: https://savelife.in.ua/en/donate/, and there is a special bank account that accepts funds in multiple currencies: https://bank.gov.ua/en/about/support-the-armed-forces. I donated to them. Please donate if you can!

Killer putin

Killer putin. Source: politico.eu.

Arrested putin

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

Rename downloaded youtube videos with mod time

| comments

It started with me wanting to download youtube videos as music podcasts (because a number of interesting people post youtube videos even though they mostly don’t show anything; this is very annoying). This is easy to do on a computer (as opposed to a mobile device) with the amazing yt-dlp! One channel has multiple videos per day and I’d like to listen to them in order, so I need to include the publication timestamp at the beginning of the downloaded filenames. The issue is that the youtube API provides upload_date and release_date metadata as a date only, not including time; release_timestamp includes time, but isn’t always available.

It’s interesting that yt-dlp sets the modification time of the file to the last modification time of the remote file:

1
2
--mtime                         Use the Last-modified header to set the file
                                modification time (default)

So I decided to use it instead (yt-dlp can provide the modified_timestamp field, but I’ve never seen it for youtube videos, therefore there is no guaranteed way to extract the Last-Modified value for the --output parameter). yt-dlp conveniently has an option to rename files after downloading! A small script is necessary to get the file modtime, format it in a human-readable way and add it to the filename.

Introducing ssponge

| comments

sponge from the moreutils package is a nice tiny tool for a specific use case when you need to read data from a file, process it and write the result back to the same file. Some unix tools allow you to do in-place editing (e.g. sed -i) whereas others don’t (e.g. awk). Well, isn’t it as easy as reading and writing to the same file?

1
$ grep -v '^#' config > config

Adjusting location of a photo on iOS

| comments

It’s great that iOS 15 (or 14?) has added a feature in the Photos.app to be able to set/adjust the photo’s location (https://9to5mac.com/2021/11/02/change-photo-date-time-iphone-ios-15/). I decided to add locations to some old photos. It’s not a fast process on the phone, at least since there are no filters to find photos without location (I could try using Photos.app on OSX, but I just don’t trust it to be able to import and export all the photos to the iPhone without any other side effects; there used to be an issue with iTunes, when you imported outside photos, they couldn’t event be removed from an iPad?!).

I’m using an OpenStreetMap-based application to recollect the place where a photo was taken: Windy Maps and Pocket Earth — they both can display vector OSM maps without downloading them (I like the features of OsmAnd and Organic Maps more, but they require downloading map regions first and there are too many of those for the photos).

Showing download progress with pipes

| comments

I’m trying to learn stream processing in Haskell. There are multiple libraries available for that: pipes, conduit, streamly, etc. I know little about them and decided to start learning pipes.

I’m interested in processing data from a network socket. There is the pipes-http library for that and its doc has the basic example at https://hackage.haskell.org/package/pipes-http-1.0.6/docs/Pipes-HTTP.html. The example streams the body of an HTTP response to stdout — it works great. To start with, I’d like to extend it to display the total number of bytes downloaded so far. The pipe is of type ByteString, so it’ll produce chunks of data; it doesn’t matter how big those chunks are. I need to keep track of the total number of bytes downloaded (a job for State) and print it upon receiving each chunk. The task turned out to be more complicated than I thought.

Setting up a simple WiFi repeater-bridge on a Mikrotik

| comments

Mikrotik routers are great for people who understand networking and want to be able to tweak lots of details (I don’t claim to understand networking very well, but I do like tinkering with networks and services). They are inexpensive and can handle home office needs with ease. Also, a rare case of devices that are not made in China — they are made in Lithuania!

I have an hAP ac3 as the home router, however there are farther locations where the WiFi connectivity is unstable. I thought of setting up a WiFi repeater to move it closer to that faraway place. I wanted to connect the repeater with the router via WiFi due to some difficulties with laying an Ethernet cable between them (yes, a cable would better anyway). My pick is an mAP Lite WiFi router — a tiny, light device.

There is a short section on the wiki describing a command to setup a wireless repeater, but without much explanation or context: https://wiki.mikrotik.com/wiki/Manual:Interface/Wireless#Repeater. I’ll describe my pitfalls and my correct setup.

logrotate fails constantly on ArchLinux?!

| comments

I noticed the same thing on my two Arch Linux computers: systemctl --failed repeatedly showed logrotate.service as failed. I’d restart it, it would be successful then, but later it would fail on its own again.

Both servers had pi-hole (from AUR), which turned out to be the key here.

Stop the war!

| comments

(Slightly updated on 2022-11-12)

This is year 2022, twenty-first century. I heard three explosions in the early morning on February 24, 2022 in my city of Odessa, Ukraine — they were one of the first attacks of russian army on Ukraine. This war has been going on for six days now, with dozens of civilian deaths on our side, and many more (thousands) deaths of the enemy soldiers, who didn’t know where they were going. The enemy has fallen to destroying civil infrastructure; the government of Belarus has been helping russian troops. It is now spring, March 1 and it is even snowing here. Our Slavic nations are all friendly people to each other (apparently, that’s not true for most, or some, russians), we don’t need this putin’s war. There is absolutely no reason or excuse for one country to invade another independent, sovereign country; this is also a flagrant violation of international agreements!

There is a lot of international support for Ukraine, and there is always more that can be done to stop this sooner rather than later. I like this tweet from Dee Snider:

I absolutely approve of Ukrainians using “We’re Not Gonna Take It” as their battlecry. My grandfather was Ukrainian, before it was swallowed up by the USSR after WW2. This can’t happen to these people again! #FUCKRUSSIA

I listened to the lyrics of the song and it is very pertinent to the situation. What an amazing song!

There is a fund to support the Ukrainian Army: https://savelife.in.ua/en/donate/, and there is a special bank account that accepts funds in multiple currencies: https://bank.gov.ua/en/about/support-the-armed-forces. I donated to them. Please donate if you can!

Stop the war! Fuck putin!

Fixing % in vim in js/tsx files

| comments

I’ve started working with javascript/typescript files at work recently, and vim has been fine for my tasks. However after a while, I noticed that the % key sometimes didn’t work in js/tsx files, specifically I couldn’t jump between parenthesis ()/braces {} in a pair, e.g. in const foo = (bar) => { … };. I couldn’t find an answer to the “broken %” in vim online.

Creating birthdays calendar

| comments

Yesterday I pushed a v0.5 release of my new tiny utility b2c. It solves the problem of generating a birthdays calendar for fastmail. Fastmail does have an autogenerated birthdays calendar feature, but it lacks any settings to setup reminders, and there are no reminders for those events by default, which makes it mostly useless to me.

b2c is a tool that reads a vCard 3.0 contacts file and generates an iCalendar calendar file with one event for each contact that has birthday information. Unfortunately fastmail doesn’t have official APIs to access contacts and calendars, so the workaround is to export the vcf file with all contacts, run b2c, and import the generated ics calendar file to fastmail via the web interface. Since my contacts list is pretty static, this is good enough for me.