Categories
Snippets

Dealing with spaghetti code in PHP: Using anonymous functions to extract pieces of template code

Recently I’ve been helping out a friend with trying to make sense of some code and how to modify it to work well with asynchronous calls to the backend. A bonus would be to be able to write it in a more modular and reusable way. The code is a WordPress plugin that was written […]

Categories
Uncategorized

Arduino/ESP32: Disabling the task watchdog

Recently I’ve been playing around with ESP32’s multicore functionality and task pinning to specific cores. I was using AutoConnect to support WiFi connection without storing credentials in the code and provide OTA updates via the web UI. This was for a project that was going to control some CPU 4-pin PWM fans that are in […]

Categories
Snippets Technology

Setting up a YubiKey for Git commit signing

I’ve been using a YubiKey as a 2-Factor Authentication key and to sign my Git commits. Until a few days ago I’ve been using a YubiKey 4. Since my current computer doesn’t have any USB-A ports, I’ve been juggling a USB-A-to-USB-C adapters in my backpack and using the key has been a hassle for the […]

Categories
Homelab

e1000e eth0: Detected Hardware Unit Hang

Recently my home server and VM host randomly started losing network connectivity. On the outside it seems that it was still working, but I was unable to access it in any remote way. The ethernet adapter seemed to be on, according to the switch, so the issue must have been somewhere in software. It wouldn’t […]

Categories
Homelab Snippets Technology

Snippets: Running a local/private swarm Docker image registry

Today I was trying to generate a Docker image from a Node.js project and I wanted to deploy it on my local test swarm. Unfortunately if one builds a local Docker image, this image is stored and accessible only to the node it was created on and the other swarm nodes can’t access it. The […]

Categories
Uncategorized

Snippets: Map Apple Keyboard Section sign key to back quote ( § to ` )

I’ve been using the Apple keyboards for a while, but when you live in Europe it’s not easy to source the US layout ones that I’m used to. On macOS there’s an “easy” way to remap the keyboard with just a terminal command: watch -n1 -x hidutil property -m ‘{“ProductID”:592, “VendorID”:1452}’ –set ‘{“UserKeyMapping”:[{“HIDKeyboardModifierMappingSrc”:0x700000035,”HIDKeyboardModifierMappingDst”:0x700000064}]}’ What this […]

Categories
Apple Technology

Resetting/Restarting Apple TV remote

Last night during a guest visit, I managed to submerge our Apple TV remote under water. Lack of sleep and unstable glasses result in accidents. The remote was working well last night, but today it stopped working. Not responding to any actions. I tried bashing it in my hand, shaking water out of it. It […]