Skip to content

Instantly share code, notes, and snippets.

Avatar

Stuart Longland sjlongland

View GitHub Profile
@sjlongland
sjlongland / gist:43bbe76efcb7a63a0e12ff1cceef55ee
Created Apr 6, 2020
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 Sep 24, 2019
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
View gist:7ef0f7cb7a5a2c76e686701889110f18
{
"cs": {
"p": 123,
"m": "a",
"a": "2001:db8:aaaa:bbbb::101"
},
"ts": {
"c": {
"c1": [
"p"
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 Feb 7, 2018
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 Jan 8, 2018
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 Dec 21, 2017
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,

@sjlongland
sjlongland / connection.py
Last active Dec 17, 2017
Integrating bacpypes into tornado
View connection.py
# 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 / haystack2dot.py
Last active Jun 26, 2018
Visualising Project Haystack graphs using pyhaystack and graphviz
View haystack2dot.py
#!/usr/bin/env python
# Dump a Project Haystack tree to a graphviz `dot` file.
# Example usage:
# python haystack2dot.py --client-type widesky --client-uri http://localhost:8084 \
# --client-username user@example.com --client-password password \
# --client-id aaaaaaaa --client-secret bbbbbbbb \
# --filter 'equipRef==@vrtsofteng.db1_ac1 and (point or modbusBlock or modbusReserved)' \
# --filter 'device2Ref==@vrtsofteng.db1_ac1' \
# --filter 'device2Ref==@vrtsofteng.vrtems_gw' \
@sjlongland
sjlongland / log
Created Nov 28, 2017
Attempt at overflow handling in readFrame…
View log
[DEBG]-PLAT----: State=OT_RADIO_STATE_SLEEP
[INFO]-PLAT----: PANID=FFFF
[INFO]-PLAT----: ExtAddr=FE334F746B3E6F1E
[INFO]-PLAT----: ShortAddr=FFFE
[DEBG]-PLAT----: Clear ShortAddr entries
[DEBG]-PLAT----: Clear ExtAddr entries
[DEBG]-MAC-----: SrcAddrMatch - Cleared all entries
[INFO]-PLAT----: Initialized
[DEBG]-PLAT----: State=OT_RADIO_STATE_SLEEP
[INFO]-PLAT----: PANID=FFFF