Skip to content

Instantly share code, notes, and snippets.

View jorticus's full-sized avatar
🐺

Jared Sanson jorticus

🐺
View GitHub Profile
@jorticus
jorticus / detect_cameras.py
Created November 13, 2023 06:07
dnsmasq rtmp device discovery
View detect_cameras.py
#!/usr/bin/python
#
# Dynamically populate NGINX config with network cameras
# detected via DHCP leases table and DNSMasq
#
import os
import sys
import time
@jorticus
jorticus / button.h
Created June 5, 2023 05:00
Arduino C++ Button Debouncing Template Helper
View button.h
#include <functional>
template <int _pin, uint8_t _level = HIGH>
struct Btn {
public:
static constexpr int pin = _pin;
static constexpr uint8_t level = _level;
};
@jorticus
jorticus / version.py
Created June 14, 2021 10:25
PlatformIO Build Version Generator
View version.py
#
# Build Version Generator
# Author: Jared Sanson <jared@jared.geek.nz>
# License: MIT
#
# Computes the current build version based either on the latest git tag + commit,
# or a pre-defined version specified in JSON.
#
# Version is built into a standalone library as a string that can be
# referenced by the application.
View fontgen.py
#
# FontGen
# Copyright (C) 2013 Jared Sanson <jared@jared.geek.nz>
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
#
# Requires Python Imaging Library (PIL)
#
# To add a new font, create a new FONT dictionary and tweak the parameters
# until the output .png looks correct.
@jorticus
jorticus / di.py
Last active August 29, 2015 14:26
Script to retrieve the complete list of di.fm channels, allowing them to be saved as pls files
View di.py
import urllib2
import json
import sys
from random import randint
def get_channel_list():
print "Requesting channel list..."
req = urllib2.urlopen('http://listen.di.fm/public%d' % randint(1, 3))
return json.loads(req.read())