Active nav macro in Zola

March 08, 2025

A little Tera macro—that I'm using with Zola—for tossing an active class onto the navigation item for the current page.

{% macro menu_item(url="/", name) %}
  {% set path = "/" %}
  {% if current_path %}
    {% set path = current_path %}
  {% endif %}

  <li>
    <a class="{% if path is containing(url) %}active{% endif %}" href="{{ url }}">{{ name }}</a>
  </li>
{% endmacro %}

Usage:

{% import 'macros.html' as macros -%}

[...]

<div class="menu">
	<ul>
	  {{ macros::menu_item(url="/writing/", name="writing") }}
	  {{ macros::menu_item(url="/projects/", name="projects") }}
	  {{ macros::menu_item(url="/iota/", name="iota") }}
	</ul>
</div>

To be a good steward

June 26, 2022
services:
  wg:
    image: ghcr.io/raylas/wg-peer:latest # Dead image, sorry
    cap_add:
    - NET_ADMIN
    - SYS_MODULE
    sysctls:
      net.ipv4.conf.all.src_valid_mark: 1
    network_mode: bridge
    ports:
    - 9091:9091
    environment:
      INTERFACE: wg0
    volumes:
    - ./wg0.conf:/etc/wireguard/wg0.conf

  transmission:
    image: linuxserver/transmission:latest
    network_mode: "service:wg"

Key bits:

  • Tunnel service uses network_mode: bridge
  • Tunneled services use network_mode: "service:wg"

In this case, the transmission service will use the wg service as its default gateway. Whereas the wg service will route its internet-bound traffic via the local host's bridge network.

Port forwarding for transmission is configured on the wg service for local access.


Cat hair and pulleys

July 03, 2021

That string and pulley tuning mechanism is likely the most interesting piece of technology engineering I've seen lately.

This old Pioneer SX-780 receiver is something my partner had when we initially moved in together. It's quite literally a corner piece to our living room and brings both our turntable and our wireless audio solution to life.

I recently had the top case removed to remove about a year's worth of cat hair from the inside (sorry audiophiles) and couldn't help but appreciate the refreshing simplicity of the internals. From the chunky diodes and capacitors to the colored wires jumpered from one side of the early PCB to the other, I knew I could make repairs on my own if it came to that.

The original manual!

Some technical highlights:

  • Receives AM/FM
  • A + B speaker outputs
  • 4 RCA inputs: AUX, Tape 1, Tape 2, Phono
  • 2 RCA outputs: Tape 1, Tape 2
  • Loudness switch
  • 15hz low frequency filter
  • Headphone output

Who hasn't been building a small Pi-based Kubernetes cluster at home?

Well, on mine I wanted to deploy a DaemonSet with node_exporter for my external Prometheus service to scrape metrics of each node in the cluster, so I wrote up a DaemonSet manifest and applied it to my cluster. On first glance everything seemed happy, but quickly I noticed that the master node was not running a node-exporter pod!

A quick Stack Overflow search led me to this answer and informed me that since Kubernetes 1.6 you have to add a toleration to the Pod spec section of your DaemonSet manifest:

tolerations:
- key: node-role.kubernetes.io/master
  effect: NoSchedule

I added this, and my master node was now running a node-exporter pod—just as I wished.

At work today I needed this command to test UDP traffic to a particular endpoint, and thought I'd leave it written down here!

This netcat command sends a single UDP packet with the string "foo" to a particular IPv4 address on a particular UDP port:

$ echo -n “foo” | netcat -u -w1 <host_ip> <port>

I use pass for password management and I ran into the following error when trying to retrieve a passphrase from its GPG store this morning:

$ gpg: WARNING: server 'gpg-agent' is older than us (2.2.13 < 2.2.15)

To fix this mismatch in version (after an update to GnuPG was installed) you need to kill the running version:

$ gpgconf --kill -v gpg-agent

After that pass should work once more, and not throw the "older than us" error.

It's beyond easy to pair AirPods with a non-Apple device. And on Arch, it's trivial to have the AirPods appear in the bluetooth manager (in this case, blueman-applet)--but when you try to initiate pairing, it does not succeed.

The trick here--if you don't require pairing with Bluetooth LE devices--is to manually specify that the bluetooth controller (bluez) use BR/EDR transport rather than allow both transport modes.

Open a shell and do the following:

$ sudo vi /etc/bluetooth/main.conf

Uncomment and manually set ControllerMode to BR/EDR:

# Restricts all controllers to the specified transport. Default value
# is "dual", i.e. both BR/EDR and LE enabled (when supported by the HW).
# Possible values: "dual", "bredr", "le"
ControllerMode = bredr

Restart the bluetooth service:

$ sudo systemctl restart bluetooth

Try re-pairing!

2018 is the year of Linux on the desktop—but only for me and only since I started working at a new company where I use Fedora for ~ eight hours daily. Coming from 10+ years of using Macs at work, the biggest change is using Ctrl + C/V for copy/paste and not Cmd + C/V. A couple of weeks in and my hand began to get a slight cramp from using my pinky and index fingers rather than my thumb and index fingers for the operation.

After reading how to remap keys with xmodmap, the configuration below is what I came up with.

Once parsed by Xorg, this lines in this file will remap right alt to right super, left alt to right control and left super to left alt.

$ vi ~/.Xmodmap
clear control
clear mod1
clear mod4
keycode 133 = Alt_L Meta_L
keycode 37 = Control_L
keycode 64 = Control_R
keycode 108 = Super_R
add control = Control_L Control_R
add mod1 = Alt_L Meta_L
add mod4 = Super_R

Confirm that this file is in your home directory, logout, log back in, and test. This may break existing shortcuts, so be sure to remap as neccessary under Settings > Keyboard > Application Shortcuts.