Skip to content

Instantly share code, notes, and snippets.

View sjlongland's full-sized avatar

Stuart Longland sjlongland

View GitHub Profile
@sjlongland
sjlongland / dirlist.cpp
Created October 8, 2026 23:15
Listing the XDG menu tree in C++
/*
* Proof-of-concept XDG menu lister.
* a precuror to a XDG menu-based launcher.
*
* © Stuart Longland
* SPDX License Identifier: LGPL-2.1+
*
* Compile with:
* g++ -std=c++20 -o dirlist dirlist.cc \
* $( pkg-config --cflags --libs glibmm-2.68 libxml++-5.0 )
@sjlongland
sjlongland / ejabberd.log
Created September 23, 2026 04:41
ejabberd crash during connection
2026-09-23 14:10:35.919532+10:00 [info] <0.1734.0>@ejabberd_listener:accept/7:384 (<0.1947.0>) Accepted connection [2001:44b8:21ac:7053:42a3:8dd8:71b7:9032]:58954 -> [2001:44b8:21ac:7080::1c]:5222
2026-09-23 14:10:35.924695+10:00 [notice] <0.1947.0> (tcp|<0.1947.0>) Received XML on stream = <<"<?xml version='1.0'?><stream:stream xmlns=\"jabber:client\" version=\"1.0\" xmlns:stream=\"http://etherx.jabber.org/streams\" to=\"chat.vk4msl.com\" xml:lang=\"en\">">>
2026-09-23 14:10:35.925168+10:00 [notice] <0.1947.0> (tcp|<0.1947.0>) Send XML on stream = <<"<?xml version='1.0'?><stream:stream id='6446934617413105067' version='1.0' xml:lang='en' xmlns:stream='http://etherx.jabber.org/streams' from='chat.vk4msl.com' xmlns='jabber:client'>">>
2026-09-23 14:10:35.925749+10:00 [debug] <0.1947.0>@ejabberd_hooks:safe_apply/4:452 Running hook c2s_stream_started: mod_client_state:c2s_stream_started/2
2026-09-23 14:10:35.926318+10:00 [debug] <0.1947.0>@ejabberd_hooks:safe_apply/4:452 Running hook c2s_stream_started: mod_stre
@sjlongland
sjlongland / slop-commits.txt
Created August 20, 2026 23:42
LLM-assisted Linux kernel commits, up to kernel 7.0.11
From: Coiby Xu <coxu@redhat.com>
Subject: [PATCH 08018/58437] crash: add KUnit tests for
Assisted-by: Google Gemini
---
kernel/Kconfig.kexec | 11 ++
kernel/Makefile | 1 +
kernel/crash_core.c | 15 ++
kernel/crash_core_test.c | 343 +++++++++++++++++++++++++++++++++++++++
4 files changed, 370 insertions(+)
create mode 100644 kernel/crash_core_test.c
@sjlongland
sjlongland / asyncioexample.py
Last active October 26, 2025 00:39
Running a background AsyncIO thread without blocking main thread
#!/usr/bin/env python3
import threading
import functools
import logging
import asyncio
import time
import sys
@sjlongland
sjlongland / gh36273-4.4.5.patch
Created October 14, 2025 10:35
Mastodon GH36273 fix backported to Mastodon 4.4.5
diff --git a/app/lib/request.rb b/app/lib/request.rb
index 4858aa4bc..de67d1659 100644
--- a/app/lib/request.rb
+++ b/app/lib/request.rb
@@ -65,6 +65,7 @@ class Request
# and 5s timeout on the TLS handshake, meaning the worst case should take
# about 15s in total
TIMEOUT = { connect_timeout: 5, read_timeout: 10, write_timeout: 10, read_deadline: 30 }.freeze
+ SAFE_PRESERVED_CHARS = '+,'
@sjlongland
sjlongland / board.dts
Created September 18, 2025 02:23
RS-485 on Zephyr
&uart0 {
compatible = "nordic,nrf-uarte";
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
/*
@sjlongland
sjlongland / mains-ctl.sh
Created August 31, 2025 03:17
Controlling a 240V battery charger with a TS-7670 MODBUS 24V switch
#!/bin/sh
# Controlling the 24V power MOSFETs in the TS-7670
# for 240V solid-state relay control.
#
# © 2025 Stuart Longland VK4MSL
# GPIOs for the various control lines.
# References:
# - https://cdn.embeddedts.com/resource-attachments/ts-7670-schematic.pdf
@sjlongland
sjlongland / inetstatus.sh
Created March 10, 2025 14:58
Internet status check for PPPoE on OpenBSD
#!/bin/sh
INTERFACE=pppoe0
CACHEDIR=/var/cache/inetstatus
LASTSTATE=${CACHEDIR}/last
date=$( TZ=UTC date "+%Y-%m-%dT%H:%M:%SZ" )
eval $(
ifconfig ${INTERFACE} \
| sed -ne '/sid:/ { s/^.*PADI retries: \([0-9]*\) PADR retries: \([0-9]*\) *.*$/padi=\1 padr=\2/; p; }; /status:/ { s/^.*: \(.*\) *$/status="\1"/; p; }'
@sjlongland
sjlongland / gist:4fa62cd5dd1e8351212c4f5d03eeceaf
Created October 5, 2024 04:21
Samsung N150+ dmesg (DragonFlyBSD 6.4)
Copyright (c) 2003-2022 The DragonFly Project.
Copyright (c) 1992-2003 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
MPTABLE: warning duplicated PCI int entry for bus 0, dev 29, pin 0
MPTABLE: warning duplicated PCI int entry for bus 0, dev 31, pin 1
DragonFly v6.4.0-RELEASE #54: Fri Dec 30 09:06:50 PST 2022
root@pkgbox64.dragonflybsd.org:/usr/obj/usr/src/sys/X86_64_GENERIC
acpi_hpet: frequency 14318180
Using cputimer HPET for TSC calibration
@sjlongland
sjlongland / README.md
Created July 18, 2024 07:48
SVG Template engine in Python

Proof of concept SVG template engine

This is an attempt to do SSTV images using SVG-based templates. The idea is to be able to create "message images" that just contain arbitrary text, and "reply images" which are used to respond to a transmission.

Usage

Edit the template template.svg to taste, putting in your details for things like the call-sign.