👋 Hey friends!

Welcome to my personal blog.

I write about technology with the focus on software development and everything around it.

You can read more about me in About section.

Google Sheets: Convert Euro Amount to Text in Latvian

Could not find a trusted ready-made function to convert euro amounts to text in Latvian in Google Sheets. Created my own version using Google Apps Script, covered function with unit tests to validate correct conversion for various amounts. Function supports conversion of amounts between minus one to one trillion; fractions of cents are not supported. To use from your Google spreadsheet: Navigate to Extensions -> Apps Script; Copy-paste code here to Code.gs and save (⌘+S on Mac, Ctrl+S on Windows/Linux); (Optional) To verify the conversion function works as expected, run unit tests: from the script toolbar, select the testEuroAmountToTextInLatvian function and press ▶️ Run. The execution log should look like below, resulting in 0 failed test cases. 10:41:51 PM Info Starting tests... 10:41:51 PM Info ✓ Test 1 PASSED: 0 => "nulle eiro" 10:41:51 PM Info ✓ Test 2 PASSED: 1 => "viens eiro" ... 10:53:36 PM Info ✓ Test 55 PASSED: 987654321 => "deviņi simti astoņdesmit septiņi miljoni seši simti piecdesmit četri tūkstoši trīs simti divdesmit viens eiro" 10:53:36 PM Info ✓ Test 56 PASSED: 999999999999 => "deviņi simti deviņdesmit deviņi miljardi deviņi simti deviņdesmit deviņi miljoni deviņi simti deviņdesmit deviņi tūkstoši deviņi simti deviņdesmit deviņi eiro" ... 10:41:52 PM Info ======================================== 10:41:52 PM Info Total tests: 76 10:41:52 PM Info Passed: 76 10:41:52 PM Info Failed: 0 10:41:52 PM Info ======================================== Setup is complete. Now go back to your sheet and verify the function is working. For example, in any cell enter =euroAmountToTextInLatvian(123.45), which should result in viens simts divdesmit trīs eiro un 45 centi being displayed in the cell.

October 12, 2025 · 2 min · 262 words · Maxim

Maintain Homebrew for Apple Silicon and Rosetta

I needed to have Homebrew available for x86_64 in Rosetta mode without conflicting with native Apple Silicon mode. To do that: Instantiate a new Terminal running in Rosetta: open -a Terminal --new --arch x86_64 In the new Terminal, install Homebrew as per the official manual: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" Edit .zprofile to: Output current architecture Add x86 to Terminal title when running in Rosetta mode Use corresponding brew version to match current architecture title() { printf '\e]0;%s\a' "$1" } # Detect architecture and set up Homebrew accordingly ARCH=$(arch) echo "Current architecture: $ARCH" if [[ $ARCH == "arm64" ]]; then # Apple Silicon eval "$(/opt/homebrew/bin/brew shellenv)" else title "x86" # Intel eval "$(/usr/local/bin/brew shellenv)" fi

August 22, 2025 · 1 min · 115 words · Maxim

Run Applications in Rosetta on macOS

I needed to run Terminal in x86_64 mode (Rosetta) in parallel with Terminal in arm64 (Apple Silicon native mode), but in the latest versions of macOS, the old way of creating a copy of the Terminal application and selecting Open using Rosetta in Get Info is not available, since Terminal can’t be copied anymore due to security restrictions. To overcome this, you can use the following command to open any application in Rosetta mode from either Terminal or Automator: ...

August 22, 2025 · 1 min · 157 words · Maxim

GPIO as Keyboard on Linux

The Linux kernel provides the gpio-keys driver (CONFIG_KEYBOARD_GPIO) that can map GPIO pins to keyboard keys and expose them to userspace as input devices. Minimal device tree overlay fragment example: &{/} { gpio_keys { compatible = "gpio-keys"; #address-cells = <1>; #size-cells = <0>; enter_button { label = "enter"; linux,code = <KEY_ENTER>; gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; }; }; }; Check your board documentation and device tree for GPIO controller names, indexes, and mapping to physical pins. You might also need to adjust pinctrl for multiplexing and pin configuration. ...

July 29, 2025 · 2 min · 248 words · Maxim

Cleanup GitLab Runner Docker Cache

If you have a self-hosted GitLab Runner with Docker executor, you need to periodically clean up Docker containers and volumes left by job executions. Otherwise, the runner machine will eventually run out of space. GitLab Runner installation comes with a script designed to accomplish cleanup: /usr/share/gitlab-runner/clear-docker-cache To see how much space can be reclaimed, run: sudo /usr/share/gitlab-runner/clear-docker-cache space To run cleanup every Sunday at 2:00 AM, add the following using the sudo crontab -e command: ...

July 28, 2025 · 1 min · 81 words · Maxim