weekends are for leisure

Re-theme in progress

I’ve been fighting against the theme I was using for this blog for a couple years now. It hadn’t been updated to work with newer versions of Hugo, which is the tool I use to convert my writings into a themed, usable website.

So a month ago I decided to create my own theme, after avoiding this rabbit-hole for years. I knew there’d be a multi-hour learning curve involved, but now felt like the right time.

Continue reading

QNAP QWA-AC2600 on Linux, setting the country code for hostapd

Setting the country code within the hostapd config doesn’t work on Debian bookworm or Ubuntu 22 LTS. Nor does using iw reg set US without a workaround. The trick is to remove all kernel modules for the card, then use iw reg set US and reload the modules.

The card worked fine under Debian 11. I have a hunch things broke when Linux moved away from the CRDA package, but I’m not a kernel developer. If you know what may have happened, please let me know.

Continue reading

Tutorial: Using ARMv6 SIMD Intrinsic Instructions on a Raspberry PI Zero W

Raspberry Pi Zero W computers have a single core ARM1176JZF-S CPU that implements version 6 of the ARM11 ARM architecture. From the docs:

It supports the ARM and Thumb instruction sets, Jazelle technology to enable direct execution of Java bytecodes, and a range of SIMD DSP instructions that operate on 16-bit or 8-bit data values in 32-bit registers.

The SIMD (Single Instruction Multiple Data) instructions are what we’ll be talking about in this tutorial. These instructions can help you speed up an application than needs to perform the same operation on many pieces of data. If you have two arrays of integers and you want to add each corresponding element and store the result in a third array, you can use SIMD instructions to perform four additions at a time.

Continue reading

Rust Sharding StatsD Proxy: Performance Improvement

If it ain’t broke, make it faster.

I’m writing a sharding StatsD proxy as a way to learn the Rust programming language. This is just a toy project, but I’m treating it as if it were something I’d run in production where I care about performance.

This proxy can be used to spread StatsD message load across N downstream servers (ie. Telegraf with the StatsD input plugin). However, due to the way metrics are stored in a timeseries database like InfluxDB, we need to ensure consistent hashing. You can think of it as an AWS Load Balancer with sticky sessions enabled. The proxy must always forward the same StatsD message – a measurement and it’s unique tags+values – to the same downstream server.

Continue reading

Setting the Time on a PineTime running InfiniTime

I recently bought a PineTime watch on a whim. And I’m still not sure what I’m going to do with it, but it runs an open source operating system (InfiniTime based on FreeRTOS) so I’m lured by the thought of customizing or contributing in some way no matter how small.

The first thing I noticed when booting my watch for the first time is the battery indicator didn’t seem to be working despite the fact that I was actively charging it. I assumed this was a bug in the version of InfiniTime that ships with the watch (0.7 IIRC), so I headed to the wiki to see how to flash a newer version.

Continue reading

Learning Rust - Sharding StatsD Proxy

TL;DR: I’m learning Rust, creating a sharding StatsD proxy as a learning project, and am creating YouTube videos of the process. See Relaxing With Code.

Continue reading

Android Text Message Backup

I’ve wanted to “factory reset” my old Android phones for years but hadn’t found a good way of exporting text messages including the embedded images and videos. Some solutions involve rooting your phone, and I didn’t want to do that. Nor did I want to use an app that copied to Gmail or the cloud. And I wanted to know exactly what the app’s code was doing. So I found the MessageBackup repo on GitHub and used it as a starting point.

Continue reading

Flashing a Dell BIOS using FreeDOS and a USB stick

I recently purchased a Dell Mini 1012 on Ebay and wanted to ensure it had the latest BIOS update from 2011. Dell’s website provides an exe, but I rarely boot into Windows. I managed to find a Linux-only workaround.

What I Tried

It was a bit of a journey. If you want the TL;DR, go to the next section.

  1. According to Ubuntu’s Dell BIOS page you can flash the BIOS using FreeDOS and a USB stick. Sounds promising.
  2. On a Linux machine I downloaded the “Lite USB” version of FreeDOS
  3. Flashed it to a USB stick with a command like this: dd if=./FD12LITE.img of=/dev/sde bs=4M conv=fsync status=progress
  4. Mounted the filesystem with a command like this: mount /dev/sde1 /mnt/other
  5. Tried to copy the BIOS exe into /mnt/other but there was no space on the filesystem. The FreeDOS image makes a very small FAT16 filesystem on the device
  6. I then tried to resize the filesystem (to give me enough free space for the BIOS exe) using gparted but gparted wasn’t able to resize
  7. I considered doing the same with the CDROM image, but really didn’t want to resize any partitions at all …
  8. Then I realized I could likely gain free space by deleting files from the FULL version of FreeDOS
  9. So I downloaded the “Full USB” version of FreeDOS instead
  10. Wrote it to the USB stick (same as above)
  11. Mounted the filesystem
  12. Explored the contents and ultimately decided to delete the packages/games folder since it was large
  13. Copied the BIOS exe to /mnt/other
  14. Unmounted the filesystem
  15. Booted with it
  16. Skipped FreeDOS installation to go back to DOS. Believe it was second menu option
  17. Tried to run the BIOS exe. Grr, it said it can only be run from within Windows.
  18. Uhhhhh
  19. I checked the notes associated with the BIOS exe on Dell’s website and saw this: “This file contains a compressed (or zipped) set of files. Download the file to a folder on your hard drive, and then run (double-click) it to unzip the set of files”.
  20. I thought to my self: Ok, it’s a self-extracting exe. That must be a pretty standard format. I wonder if the unzip command on Linux can extract it?
  21. Turns out unzip CAN extract a self-extracting exe. Yes!
  22. I remounted the USB filesystem to /mnt/other, navigated to it within a terminal
  23. Ran: unzip ./R30BLABLA.exe
  24. It extracted the contents within the USB stick
  25. Woo!
  26. umount /mnt/other
  27. Reboot laptop
  28. Skip FreeDOS install, menu option 2
  29. Run exe that isn’t prefixed with “win”
  30. Watch while the BIOS is flashed

What Actually Worked

Condensed steps from my journey above.

Continue reading

HD Motion Detection, Streaming, Encoding on a single Raspberry Pi

This post is about how and why I pieced together my own motion-detection and encoding system. I wanted to produce smooth HD videos whenever motion was detected. Find the code here.

Note: I plan to add videos and stills to make this more than a wall of text, but wanted to get it out before the holidays.

Raspberry Pi computers are powerful despite being small. Did you know the raspivid program can capture 1080p at 30fps without breaking a sweat? Given that, I figured it should be possible to layer on motion detection without impacting the HD video quality too greatly. But like many things, it’s harder than you might think.

Continue reading

Effective Horns

Queued up some Koufax on my morning walk. It had been a while. Sometimes I forget how effective horns can be. Move Out, Move On.

Continue reading