Skip to content

Instantly share code, notes, and snippets.

Avatar

Stuart Longland sjlongland

View GitHub Profile
@sjlongland
sjlongland / example-chirp-output.csv
Last active January 14, 2023 02:48
Python script to sort WIA Repeater Data entries by geographic location
View example-chirp-output.csv
Location Name Frequency Duplex Offset Tone rToneFreq cToneFreq DtcsCode DtcsPolarity RxDtcsCode CrossMode Mode TStep Skip Comment URCALL RPT1CALL RPT2CALL DVCODE
0 8CAWest Gap 2 146.95 - 0.6 Tone 91.5 91.5 23 NN 23 Tone->Tone FM 25.0 0
1 8ITWest Gap U 438.525 - 5.0 Tone 91.5 91.5 23 NN 23 Tone->Tone FM 25.0 0
2 6AAMt Barker 2 146.825 - 0.6 88.5 88.5 23 NN 23 Tone->Tone FM 25.0 0
3 6AAMt Barker U 439.95 - 5.0 88.5 88.5 23 NN 23 Tone->Tone FM 25.0 0
4 6ALMt Clarence U 439.95 - 5.0 88.5 88.5 23 NN 23 Tone->Tone FM 25.0 0
5 6AWFairfield 2 147.0 - 0.6 88.5 88.5 23 NN 23 Tone->Tone FM 25.0 0
6 6MJManjimup 2 147.15 + 0.6 88.5 88.5 23 NN 23 Tone->Tone FM 25.0 0
7 6AKKalgoorlie 2 147.0 - 0.6 88.5 88.5 23 NN 23 Tone->Tone FM 25.0 0
8 6RRKalgoorlie 2 147.05 + 0.6 88.5 88.5 23 NN 23 Tone->Tone DMR 25.0 0
@sjlongland
sjlongland / gist:1dc5b4dc5dca0cf5fd928f795f64bb8a
Last active March 29, 2022 04:23
Shell script to generate blacklists by country code
View gist:1dc5b4dc5dca0cf5fd928f795f64bb8a
#!/bin/sh
# This is a script I use on my own personal servers to block the following countries:
# Belarus: for supporting Russia
# China: for human rights abuses in Xinjiang
# Hong Kong: because China claims this is "their" territory and the HK government seems to agree
# Russia: Invasion of Ukraine (ohh, and BTW… Пу́тін — хуйло́ / Пу́тин — хуйло́)
# Provided in the public domain without any guarantee or warranty whatsoever, use at your own risk.
# Typical usage in `pf`:
@sjlongland
sjlongland / mqtt.py
Last active August 22, 2021 07:43
Proxying MQTT/websockets from aiohttp to back-end MQTT server (amqtt in this case)
View mqtt.py
from yaml import safe_load
from asyncio import coroutine, gather, get_event_loop, ensure_future
from aiohttp.web import json_response, Application, View, WebSocketResponse
from aiohttp import WSMsgType, ClientSession
# Read a configuration file
config = safe_load(open('config.yml','r').read())
# Set up the core application
@sjlongland
sjlongland / gist:43bbe76efcb7a63a0e12ff1cceef55ee
Created April 6, 2020 11:16
Asterisk codec negotiation with SIP provider on incoming call
View gist:43bbe76efcb7a63a0e12ff1cceef55ee
[Apr 6 20:49:17] Asterisk 16.6.2 built by _pbuild @ amd64-stable.ports.openbsd.org on a amd64 running OpenBSD on 2019-11-22 09:21:53 UTC
[Apr 6 20:49:17] NOTICE[-1] loader.c: 306 modules will be loaded.
[Apr 6 20:49:18] ERROR[-1] res_config_sqlite3.c: Missing config file 'res_config_sqlite3.conf'
[Apr 6 20:49:18] ERROR[-1] config_options.c: Unable to load config file 'statsd.conf'
[Apr 6 20:49:18] NOTICE[-1] res_statsd.c: Could not load statsd config; using defaults
[Apr 6 20:49:18] ERROR[-1] config_options.c: Unable to load config file 'udptl.conf'
[Apr 6 20:49:18] NOTICE[-1] udptl.c: Could not load udptl config; using defaults
[Apr 6 20:49:18] ERROR[-1] config_options.c: Unable to load config file 'acl.conf'
[Apr 6 20:49:18] NOTICE[-1] manager.c: Unable to open AMI configuration manager.conf, or configuration is invalid.
[Apr 6 20:49:18] ERROR[-1] config_options.c: Unable to load config file 'features.conf'
@sjlongland
sjlongland / aes.c
Last active September 24, 2019 23:46
AES/SHA mbedtls implementation
View aes.c
/* vim: set tw=78 sw=4 ts=4 et:
* Copyright (c) 2017, VRT Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
@sjlongland
sjlongland / gist:7ef0f7cb7a5a2c76e686701889110f18
Created January 2, 2019 21:14
JSON blob of configuration data
View gist:7ef0f7cb7a5a2c76e686701889110f18
{
"cs": {
"p": 123,
"m": "a",
"a": "2001:db8:aaaa:bbbb::101"
},
"ts": {
"c": {
"c1": [
"p"
@sjlongland
sjlongland / gist:007d0385b1f6cd2b37c0192a2ce0cecc
Created March 2, 2018 04:16
BACnet connection management
View gist:007d0385b1f6cd2b37c0192a2ce0cecc
# MeterMaster Data Access Layer
# (C) 2017 VRT Systems
#
# The following Software is the proprietary property of VRT Systems.
# Unauthorised disclosure or use of this Software is forbidden to the extent
# permitted by law.
#
# vim: set ts=4 sts=4 et tw=78 sw=4:
from threading import Event, Semaphore, Thread
@sjlongland
sjlongland / test.sh
Created February 7, 2018 02:09
pika test case: channel close bug
View test.sh
#!/bin/sh -ex
: ${PYTHON2:=$( which python2 )}
: ${PYTHON3:=$( which python3 )}
pass=""
fail=""
for python in ${PYTHON2} ${PYTHON3}; do
for pika in 0.9.14 0.10.0 0.11.2; do
@sjlongland
sjlongland / radio.c
Last active January 8, 2018 06:07
Debugging the CC2538 radio driver.
View radio.c
/*
* Copyright (c) 2016, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
@sjlongland
sjlongland / README.md
Created December 21, 2017 05:43
syslogd implementation for OpenThread
View README.md

RFC 5424 compatible syslog implementation for OpenThread.

This requires:

  • a filesystem of some kind, with stubs for newlib's file I/O functions… we're using SPIFFS with a SPI EEPROM, but there are lots of options.
  • a real-time clock with an implementation of gettimeofday… we use a NXP PCF8523 I²C RTC to synchronise a software counter

If sending of a message fails (because buffers are full) and the message severity is high enough,