Skip to content

Instantly share code, notes, and snippets.

View sjlongland's full-sized avatar

Stuart Longland sjlongland

View GitHub Profile
sjlongland /
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.


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

sjlongland /
Last active July 18, 2024 02:32
Get the current maidenhead grid locator from gpsd in Python
#!/usr/bin/env python3
Retrieve the current maidenhead grid locator from gpsd and return it.
© 2024 Stuart Longland VK4MSL
License: BSD-3-clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
sjlongland / mastodon-v4.2.9-5k.patch
Created June 22, 2024 20:38
Patch to increase post limit on Mastodon 4.2.9 to 5000 characters
diff --git a/app/javascript/mastodon/features/compose/components/compose_form.jsx b/app/javascript/mastodon/features/compose/components/compose_form.jsx
index 9222b2dc8..962310a28 100644
--- a/app/javascript/mastodon/features/compose/components/compose_form.jsx
+++ b/app/javascript/mastodon/features/compose/components/compose_form.jsx
@@ -100,7 +100,7 @@ class ComposeForm extends ImmutablePureComponent {
const fulltext = this.getFulltextForCharacterCounting();
const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;
- return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (isOnlyWhitespace && !anyMedia));
+ return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 5000 || (isOnlyWhitespace && !anyMedia));
sjlongland /
Created June 22, 2024 11:02
Python asyncio multicast bi-directional communication example
#!/usr/bin/env python3
Very simple multicast IPv6 socket implementation in asyncio.
Allows for transmission and reception of UDPv6 datagrams to and from multicast
# © 2024 Stuart Longland <>
sjlongland /
Created June 15, 2024 04:33
pycose/cryptography example, incorporating Sign1, MAC0 and X25519 key exchange

X25519 / COSE example program

This is a demonstration program meant to nut out some details of how COSE and X25519 key exchange are supposed to work.


  • pycose
  • python-cryptography

How does this work?

sjlongland /
Created May 26, 2024 08:11
Crude mDNS / Wireguard based point-to-point VPN

What is this?

It's a very crude script that allows two machines that share a possibly untrusted network (e.g. WiFi) to connect to each-other and establish a secure tunnel.

How does it work?

The assumption is both machines can see each-other via multicast DNS, and can send UDP traffic between each-other. If you're using a WiFi network that isolates its clients, you're out of luck.

sjlongland / AX.25 BPQ
Last active May 6, 2024 23:56
Different AX.25 connected-mode dumps for analysis

KISS traffic dump between two connected BPQ32 stations

This is the raw hexdump obtained from socat from two station running LinBPQ32 (i386 and armv5) communicating via a virtual tunnelled serial link.

> 2024/05/05 16:16:28.000714544  length=20 from=0 to=19
 c0 01 1e c0 c0 02 40 c0 c0 03 0a c0 c0 04 03 c0 c0 05 00 c0
< 2024/05/05 16:16:28.000716883  length=9 from=0 to=8
 5e 43 c0 c0 5e 45 5e 40 c0
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
ifeq ($(VARIANT),)
# VARIANT not set, iterate over VARIANTS
.PHONY: all
sjlongland /
Created March 20, 2024 05:59
Dummy rigctld implementation for GPIO control of radio PTT
#!/usr/bin/env python3
Dummy rigctld implementation for controlling a radio PTT signal via a GPIO
This is intended for devices like the NWDR UDRC-II and DRAWS boards, which
attach to the top of a Raspberry Pi 2/3/4/5 single-board computer and provide
control signals for PTT and COS along with an audio interface for digital mode
sjlongland /
Last active March 8, 2024 07:33
Simplified widgets using tkinter.ttk.Treeview
#!/usr/bin/env python3
# Button box component, lays out buttons in a horizontal or vertical layout
# evenly.
# GUI stuff
import tkinter
from tkinter import ttk