Skip to content

Instantly share code, notes, and snippets.

View DavesCodeMusings's full-sized avatar

Dave Horton DavesCodeMusings

  • Planet Earth
View GitHub Profile
@DavesCodeMusings
DavesCodeMusings / Armbian Ubuntu on Orange Pi Zero 3.md
Last active December 14, 2025 13:06
Installing and tweaking Ambian Ubuntu for the Orange Pi Zero 3 for fun and profit!

Ubuntu Server on Orange Pi Zero 3

Even with the current tariff nonsnese, the Orange Pi Zero 3 is a cheap and fairly capable ARM single board computer (SBC). If you've mastered the Raspberry Pi and you want to branch out, Armbian Ubuntu on the Zero 3 is a good place to start.

Download and flash the Armbian Ubuntu binary image

  1. Visit the Armbian Orange Pi Zero 3 page
  2. Scroll down to Server images
  3. Download Ubuntu 24.04 (Noble), the current version at time of writing.
  4. Use Raspberry Pi Imager, Balena Etcher, or whatever to flash the binary image to microSD.

Attach a console to the Orange Pi

@DavesCodeMusings
DavesCodeMusings / tasmota-esp32c3-install.cmd
Last active December 13, 2025 16:20
Tasmota flash firmware on ESP32-C3 with esptool on Windoze 11
; This assumes Python and esptool module are installed and working.
; Download the factory image for a fresh install
curl.exe --output tasmota32c3.factory.bin --url http://ota.tasmota.com/tasmota32/release/tasmota32c3.factory.bin
; Erase before flashing
py -m esptool --port=COM3 erase_flash
; Flash the image to the first detected COM port at offset 0
py -m esptool write_flash 0x0 .\tasmota32c3.factory.bin
@DavesCodeMusings
DavesCodeMusings / README.txt
Created July 24, 2025 12:59
syslog-ng in Docker for logging network hosts
Creates a syslog server that can be used to centrally collect logs from various network devices.
You'll need a Docker compose project directory structure that looks like this:
-rw-r--r-- 1 root root 351 Jul 24 12:00 compose.yml
drwxr-xr-x 3 1000 1000 4096 Jul 24 12:00 config/
drwxr-xr-x 2 1000 1000 4096 Jul 24 12:00 logs/
The syslog-ng.conf goes in the config/ directory. Logs will be found in the logs/ directory.
Logs are rotated daily.
@DavesCodeMusings
DavesCodeMusings / auto-inc-property.py
Created April 3, 2025 14:19
An 8-bit number as a class property that increments itself each time it's read.
# Auto-incrementing property
class Test:
_packet_id = -1
@property
def packet_id(self):
self._packet_id += 1
self._packet_id &= 0xFF # Truncate to 8-bit max
return self._packet_id
@DavesCodeMusings
DavesCodeMusings / ip-sort.js
Last active January 10, 2025 21:56
Sort IP addresses by octet order rather than the usual string sorting
#!/usr/bin/env node
function ipv4Compare(a, b) {
let aOctets = a.split('.');
let bOctets = b.split('.');
if (aOctets.length !== 4 || bOctets.length !==4) {
throw("InvalidIPv4Address");
}
if (parseInt(aOctets[0]) > parseInt(bOctets[0])) {
@DavesCodeMusings
DavesCodeMusings / containers.conf
Created January 7, 2025 18:54
Monit alerts for down Docker containers
check program containers with path "/usr/bin/docker ps --format '{{ .Names }}' --filter 'status=exited'"
every 120 cycles
if content != "" then alert
@DavesCodeMusings
DavesCodeMusings / fstab_align.sh
Created December 3, 2024 02:05
/etc/fstab field aligner
# Create order from chaos
awk '{ printf "%-42s %-16s %-8s %-12s %2s %2s\n", $1, $2, $3, $4, $5, $6 }' /etc/fstab > /etc/fstab.new
@DavesCodeMusings
DavesCodeMusings / random_complex_password.sh
Created November 24, 2024 05:49
Random Complex Password
#!/bin/sh
# Generate a random complex password on a Linux system.
tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' </dev/urandom | head -c 32; echo
# Reference:
# https://owasp.org/www-community/password-special-characters
# https://www.gnu.org/software/coreutils/manual/html_node/tr-invocation.html
@DavesCodeMusings
DavesCodeMusings / VirtualBox_Ventoy_USB_Boot.md
Last active December 31, 2024 20:05
Ventoy VirtualBox Boot

Ventoy Flash Drive as VirtualBox Boot Device

This document shows how to use a Ventoy formatted USB device (instead of an optical disk) to boot an ISO image in VirtualBox. There are other HowTo documents on the internet that explain this procedure (one is mentioned in the References section below), but most use a deprecated VBoxManage sub-command to create the raw device. This document uses the preferred createmedium sub-command. It also uses PowerShell rather than cmd.exe.

The generic form of the command that makes the Ventoy USB drive available to VirtualBox is as follows:

.\VBoxManage createmedium disk --filename=PATH --format=VMDK --variant=RawDisk --property RawDrive=DEVICE_NAME

But, there are some prerequisites...

@DavesCodeMusings
DavesCodeMusings / s31.yaml
Last active October 7, 2024 03:26
Configuration for Sonoff S31 flashed with ESPHome
esphome:
name: s31-1
friendly_name: s31-1
esp8266:
board: esp01_1m
early_pin_init: False # Mitigate relay flipping on reboot.
# Disable logging (UART is used by cse7766 power sensor.)
logger: