Skip to content

Instantly share code, notes, and snippets.

View sjlongland's full-sized avatar

Stuart Longland sjlongland

View GitHub Profile
@sjlongland
sjlongland / dummyrigctld.py
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
pin.
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
operation.
@sjlongland
sjlongland / buttonbox.py
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
@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 / config-6.5.7-vk4msl-sb-57160-gc476bbdaa3d7
Created October 21, 2023 07:12
StarBook VI Kernel configuration for AMD Ryzen 7 laptop with AMI UEFI boot firmware
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 6.5.7 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (Gentoo Hardened 13.2.1_p20230826 p7) 13.2.1 20230826"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=130201
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=24000
@sjlongland
sjlongland / socat-scrape.log
Created October 19, 2023 00:30
AX.25 connected-mode traffic between two Linux hosts
2023-10-19 10:29:38,098 socatscraper.port14[socat-scrape.py: 50] INFO Decoded frame:
[AX25SetAsyncBalancedModeFrame]
header.destination = VK4MSL-4*
header.source = VK4MSL-5
header.repeaters =
header.cr = True
header.src_cr = False
body.control = 63 (0x3f)
body.pf = True (0x1)
body.modifier = 47 (0x2f)
@sjlongland
sjlongland / mastodon-v4.2.0-5k.patch
Created September 29, 2023 23:54
Mastodon 4.2.0 5000-character post limit patch
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
sjlongland / case01-setuppy-inline-license.txt
Created August 20, 2023 02:52
License output for setuptools with different projects
+ tail -n +0 setup.py
import setuptools
setuptools.setup(
name="mypackage",
version="1.2.3",
license="""Mock License 1.0
This is a dummy license text to check how setuptools represents
it in the metadata so it can be exposed to pyproject.toml."""
# Manually typed from https://theblower.au/@DropBear/110647780217493876
Discussion over vote on Voice
A VOICE that can't be deleted.
When Assistant Minister for Indigenous Australians Malarndirri McCarthy said
that we will need to "call out the misinformation and disinformation" on the
Voice to Parliament. I got to work doing just that. I was seeing a lot of
it.
@sjlongland
sjlongland / dumpmeta.py
Last active June 27, 2023 03:07
Mucking around with `distutils` command packages
#!/usr/bin/env python3
from distutils.cmd import Command
import json
def to_json(v):
if (v is None) or isinstance(v, (bool, int, str)):
return v
elif isinstance(v, list):