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.

TimeMachine "failed to thin backups"

| comments

TimeMachine is a great program for doing automatic system backups, especially since it’s built-in to OS X and easy to use. I had to upgrade from 10.14 to 10.15 some time ago and the newer version is less stable, and also TimeMachine is now buggy. Specifically it now frequently fails to cleanup backups saying this in the logs:

1
2
3
4
5
6
7
8
9
10
2020-11-20 11:01:34.467927+0200  localhost backupd[21553]: (TimeMachine) [com.apple.TimeMachine:BackupThinning] Thinning 3 backups using age-based thinning, expected free space: 546.35 GB actual free space: 5
46.35 GB trigger 49.94 GB thin 83.24 GB dates: (
    "2020-11-18-205528",
    "2020-11-19-084150",
    "2020-11-19-093918"
)
2020-11-20 11:01:40.104450+0200  localhost backupd[21553]: (TimeMachine) [com.apple.TimeMachine:General] Failed to thin backup named: 2020-11-18-205528 completion date: 2020-11-18 18:55:28 +0000 error: Error
Domain=NSCocoaErrorDomain Code=513 "“2020-11-18-205528” couldn’t be removed because you don’t have permission to access it." UserInfo={NSUserStringVariant=(
    Remove
), NSFilePath=/Volumes/backups/Backups.backupdb/mymac/2020-11-18-205528, NSUnderlyingError=0x7f97425bd970 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}

Unit-testing absence of retain cycles in swift

| comments

ARC in Objective-C and swift is a nice technology, between manual memory management and a garbage collector. But it’s not fool-proof and you can still create retain cycles when two objects retain each other. There are numerous blog posts online explaining this problem.

It would be nice to have unit tests to verify your classes don’t have this issue, wouldn’t it? There’s a way to do that.

OSX: Close notification with keyboard

| comments

OS X’s UI looks nice, but isn’t very keyboard-friendly. For example, there is no standard shortcut to expand or minimize a window (yes, Cmd+M typically works, but it depends on the Window > Minimize menu command, which is sometimes not present). The same is true for the notification center, specifically calendar invitations/reminders that display a notification popup by default with two buttons: Close and Accept/Remind later. How do you dismiss it with the keyboard alone?

Backups, TimeMachine, HFS and pain

| comments

Disk doesn’t mount

A recent Saturday evening my external 4TB SSD for TimeMachine backups and some other data has failed to mount when connected. Strange, but it’d happened once before, and an OS restart had helped then. This time, it didn’t… While I was thinking that my SSD has suddenly started dying (it happens with hardware) and what to do about it, about 10 minutes have passed and a message popped up that said something like there is a problem with the drive, but you can still copy your data, and the volume was mounted read-only!

I tried to repair the volume in Disk Utility, but it would fail after several minutes. It wasn’t clear to me if it’s really a disk failure or a filesystem error.

Automate saving Glacier webcam pictures

| comments

Updated on 2021-04-03: An updated version of the script is described in this post.

Glacier National Park is really beautiful! The website has a dozen of webcams in different parts of the park and winter views are amazing (from the working cameras). All the webcams with their descriptions are on this page, but I like the current thumbnails page more because it provides a compact view of the current webcam images. Sometimes I want to save a picture, but I have to manually change the filename or append a suffix so that previous images from the same webcam aren’t overwritten — this is annoying. How could we automate this?

Cleaning swift build products clarifies errors

| comments

This is a quick note about the fact that if you get surprising or unexpected build errors in a swift project, cleaning the build products directory may clarify them. In AppCode, the fastest way by default is to press Cmd+Shift+A to open the action fuzzy search and type “Clean build folder”; in Xcode, the shortcut is Cmd+Opt+Shift+K.

There are two kinds of errors I’ve seen that are improved in this way:

Enabling locate on OSX

| comments

locate is a nice tool to quickly find files by name because it builds a database of all files and searches it instead of the filesystem. I know OSX has Spotlight, but it’s graphical, has some indexing issues sometimes, and the command-line client is clumsy. I prefer simpler UNIX tools. Some more info in the Arch wiki.

I’m mostly interested in locating my own files, so the database will be stored in the home directory and updated from my user, not root.

Lightweight validation in swift from scratch

| comments

Updated on 2021-06-19: published a new post about result builders for this validation.

A program that takes any input from the outside world must validate it. In a project I worked on, I encountered a problem with the code that validates a received response and I didn’t know why validation failed because the logs only said “Rejected response X because it’s invalid”. The problem is that the validation function just returned a Bool, which doesn’t carry any extra information as I show in this post.

This article is about a general idea of how to get more information from various processes in your program, in this case, from validation. It describes only the first steps and can be extended further.

The repository with the sample code is at https://github.com/eunikolsky/LightweightValidation.

Disable desktop images usage in XScreenSaver on OSX

| comments

I have previously written about XScreenSaver and selecting a random screensaver among the dozens of the great ones in the package: “OS X: flexible random screensavers”.

Some of the screensavers can display images and the default there is to use the screenshot of the current desktop; it is a sensible default, however I don’t like this mini-leakage of information. Each screensaver has a settings dialog (at least, on OS X) and you can disable the “Grab desktop images” option, enable the “Choose random images” option instead and pick a directory, such as /Library/Desktop Pictures. The problem here is that there are more than a dozen of such screensavers, I don’t know which ones, and I don’t feel like going through a hundred settings dialogs manually at all. We’ll use the terminal instead!