Skip to content

Instantly share code, notes, and snippets.

View JonathanThorpe's full-sized avatar

Jonathan Thorpe JonathanThorpe

  • Sydney, Australia
View GitHub Profile
@JonathanThorpe
JonathanThorpe / j2env.py
Last active February 19, 2021 01:18
Jinja2 Template Parser for applying environment variables to a template.
#!/bin/env python
#Date: 24 August 2018
#Bugs by: Jonathan Thorpe
import os
import re
import argparse
from jinja2 import Environment, FileSystemLoader
CWD = os.path.dirname(os.path.abspath(__file__))
@JonathanThorpe
JonathanThorpe / mikrotik-letsencrypt.sh
Last active October 12, 2024 18:33
Bash script for updating and installing a new LetsEncrypt certificate on MikroTik routers
#!/bin/bash
ACME=/root/.acme.sh/acme.sh
DOMAIN=remote.mydomain.tld
CERTPATH=/var/router-certs
CERT=$DOMAIN.cer
KEY=$DOMAIN.key
ROUTER=123.123.123.123
ROUTER_USER=SSHUser
@JonathanThorpe
JonathanThorpe / wav-riff-reader.py
Last active June 11, 2023 17:32
Python WAV File RIFF Header Reader
import struct
import io
class WAVFile:
def __init__(self, filename):
self.filename = filename
def read(self):
with io.open(self.filename, 'rb') as fh:
@JonathanThorpe
JonathanThorpe / openwebrx-nagios.py
Created November 5, 2016 23:06
Quick and dirty OpenWebRX Nagios Plugin
#!/usr/bin/env python3
import time
import websocket
import re
import requests
import math
import statistics
import threading
import sys
#init.sls
{% for webapp, data in salt['pillar.get']('web_apps', {}).iteritems() %}
/etc/nginx/sites-available/{{webapp}}.conf:
file.managed:
- user: root
- group: root
- mode: 644
- makedirs: True
- template: jinja
@JonathanThorpe
JonathanThorpe / VIM.txt
Created April 24, 2016 08:27
VIM defaults
syntax on
filetype plugin indent on
set tabstop=2
set shiftwidth=2
set expandtab
@JonathanThorpe
JonathanThorpe / sipiradio.py
Last active October 14, 2024 09:00
Si473x i2c/i2s radio for Rasperrby Pi
#!/usr/bin/python3
import quick2wire.i2c as i2c
import time
import RPi.GPIO as GPIO
import alsaaudio
import threading
import logging
import sys
#Work in progress library for Si473x for Raspberry Pi by Jonathan Thorpe <[email protected]>