Skip to content

Instantly share code, notes, and snippets.

@hdoverobinson
hdoverobinson / socat-ntp-acts.txt
Created May 9, 2017 02:14
Socat server and client for use with NTP's type 18 ACTS driver.
#This is currently used by an NTP server to access a V.92 modem over the LAN to dial the NIST ACTS.
#The options here work using a USR5686G modem over a PL2303 USB to RS232 adapter with NTP 4.2.8p8.
#NTP expects a device called "acts1" at 19200 baud. You should adjust the port number, character device file, baudrate, and lockfile to suit your environment.
#NTP will not autobaud after a successful connection using this method. The modem init string in ntpd/refclock_acts.c must be edited to lock the modem to 19200 baud.
#A ping test was added to the client to limit the number of retries it makes during a network outage.
#These are placed in startup scripts run by a cronjob.
#socat-server
/usr/bin/screen -dmS socat-server-acts1 /bin/bash -c "while true; do /usr/bin/socat -v -d -d -d -t10 tcp-l:54321,reuseaddr,keepalive file:/dev/ttyUSB0,b19200,nonblock,raw,echo=0,cread,cs8,crtscts,min=1,time=0,nl0,cr0,tab0,bs0,vt0,ff0,waitlock=/var/run/ttyUSB0.lock; done"
@hdoverobinson
hdoverobinson / iptables-docker.rules
Created May 9, 2017 02:16
Complete ruleset that allows Docker networking behind an iptables firewall with a default drop policy
*mangle
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
*nat
:PREROUTING ACCEPT [3530:581109]
@hdoverobinson
hdoverobinson / ubxconfig.sh
Last active September 24, 2024 14:54
Configure u-blox GPS/GNSS modules with Bash
#!/bin/bash
###AUTHOR###
#Harry Dove-Robinson 5/8/2017
#harry@doverobinson.me
#https://gist.github.com/hdoverobinson
#https://github.com/hdoverobinson
###USAGE###
#This is a script used to configure u-blox GPS/GNSS modules from a text file generated by u-center.
@hdoverobinson
hdoverobinson / osp-build.sh
Last active March 23, 2022 05:43
Builds Open Satellite Project xritdemod and goesdump from source
#!/bin/bash
###AUTHOR###
#Harry Dove-Robinson 12/14/2017
#harry@doverobinson.me
#https://gist.github.com/hdoverobinson
#https://github.com/hdoverobinson
###CONTENTS OF TARGET_DIR WILL BE CLEARED AT EACH RUN###
TARGET_DIR="/root/osp-build"
@hdoverobinson
hdoverobinson / dtmf-oobm.sh
Created July 27, 2017 05:42
Out-of-band management with DTMF tones on SIMCom cellular modem
#!/bin/bash
###AUTHOR###
#Harry Dove-Robinson 7/27/2017
#harry@doverobinson.me
#https://gist.github.com/hdoverobinson
#https://github.com/hdoverobinson
###USAGE###
#This is a script used for out-of-band management by way of DTMF tones over voice calls to a SIMCom cellular modem.
@hdoverobinson
hdoverobinson / osp-handler.sh
Last active February 9, 2018 04:16
Start, stop, and back up Open Satellite Project goesdump and xritdemod
#!/bin/bash
###AUTHOR###
#Harry Dove-Robinson 2018-02-08
#harry@doverobinson.me
#https://gist.github.com/hdoverobinson
#https://github.com/hdoverobinson
###NOTES###
#Used by wx-star.com for 24/7 operation of Open Satellite Project software for HRIT/EMWIN direct readout
#Manages OSP processes inside GNU Screen sessions, performs daily backups and rotation of OSP output data
#!/bin/bash
###AUTHOR###
#Harry Dove-Robinson 2018-02-04
#harry@doverobinson.me
#https://gist.github.com/hdoverobinson
#https://github.com/hdoverobinson
###CONTENTS OF TARGET_DIR WILL BE CLEARED AT EACH RUN###
DOCKER="$1"
TARGET_DIR="/root/osp-build"
@hdoverobinson
hdoverobinson / luttest.sh
Created January 12, 2018 02:13
Quickly compile goesdump with a new false color LUT
#!/bin/bash
LUT="$1"
cp "$LUT" /root/osp-build/build/goesdump/XRIT/LUT/falsecolor.png &&
cd /root/osp-build/build/goesdump/ &&
rm -rf goesdump/bin/* &&
msbuild /p:Configuration=Release goesdump.sln &&
cd goesdump/bin/Release &&
mkbundle --simple *.exe XRIT.dll -o goesdump &&
@hdoverobinson
hdoverobinson / init.goestools-noprompt.sh
Last active January 16, 2022 14:59
Installs goestools from source on Debian/Ubuntu without any prompt for deleting /usr/src/goestools
#!/bin/bash
GOESTOOLS_DIR="/usr/src/goestools"
GOESTOOLS_REPO="https://github.com/pietern/goestools.git"
BUILD_PACKAGES="apt-utils build-essential ca-certificates cmake git libairspy-dev libopencv* librtlsdr-dev pkg-config"
if [ "$EUID" -ne 0 ]
then echo "This script must be run as root!"
exit 1
fi &&
@hdoverobinson
hdoverobinson / init.ntp.sh
Last active October 21, 2018 17:59
Installs NTP on Debian/Ubuntu without prompt for deletion of /usr/src/ntp
#!/bin/bash
###Installs a minimal NTP on Debian/Ubuntu with ACTS, PPS, and NMEA clock drivers and disables timesync.d###
###Installs useful packages for working with PPS and i2c clocks###
NTPVERSION_MAJOR="4.2"
NTPVERSION_MINOR="8p12"
ADDPACKAGES="adjtimex i2c-tools pps-tools"
COREPACKAGES="ntp"
NTPURL="https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p12.tar.gz"