Skip to content

Instantly share code, notes, and snippets.

View sjlongland's full-sized avatar

Stuart Longland sjlongland

View GitHub Profile
@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 / portable_endian.h
Last active March 2, 2026 20:10 — forked from panzi/portable_endian.h
This provides the endian conversion functions form endian.h on Windows, Linux, *BSD, and Mac OS X. You still need to use -std=gnu99 instead of -std=c99 for gcc. The functions might actually be macros. Functions: htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh, le32toh, htobe64, htole64, be64toh, le64toh. License: I hereby put "port…
// "License": Public Domain
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like.
// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to
// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it
// an example on how to get the endian conversion functions on different platforms.
#ifndef PORTABLE_ENDIAN_H__
#define PORTABLE_ENDIAN_H__
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)
@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 / Makefile
Created May 3, 2024 06:18
Generating a cross-product of images for SSTV from some stock images and layers
CALLSIGNS ?= vk4msl ax4msl
VARIANTS ?= empty cq-sstv morning-all afternoon-all evening-all 73-all 73-gotta-fly
CALLSIGN ?=
VARIANT ?=
ifeq ($(VARIANT),)
# VARIANT not set, iterate over VARIANTS
.PHONY: all
@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 / client.py
Created December 30, 2023 05:30
mpd music selection algorithm
#!/usr/bin/env python
# vim: ai ts=4 sw=4 sts=4 expandtab fileencoding=utf-8
from mpd import MPDClient
## SETTINGS
##
HOST = 'localhost'
PORT = '6600'
PASSWORD = False
@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