Skip to content

Instantly share code, notes, and snippets.

View sjlongland's full-sized avatar

Stuart Longland sjlongland

View GitHub Profile
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 / portable_endian.h
Last active April 24, 2024 11:32 — 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.
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)
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