Skip to content

Instantly share code, notes, and snippets.

View casebeer's full-sized avatar

Christopher Casebeer casebeer

View GitHub Profile
{
"MaxStaticBitrate": 7789442,
"MaxStreamingBitrate": 7789442,
"MusicStreamingTranscodingBitrate": 192000,
"DirectPlayProfiles": [
{
"AudioCodec": "vorbis,opus",
"Container": "webm",
"Type": "Video",
"VideoCodec": "vp8"
@casebeer
casebeer / etc_logrotate.d_rsyslog-remote
Last active March 2, 2025 00:54
Receive remote syslog messages with rsyslog and logrotate on Ubuntu
# Logfiles under /var/log/hosts per rsyslog.d config
/var/log/hosts/*/*.log
{
rotate 7
daily
missingok
notifempty
delaycompress
compress
postrotate
@casebeer
casebeer / etc_logrotate.d_snmptrapd
Last active March 2, 2025 00:55
snmptrapd logging to rsyslogd and snmptrapd.log with logrotate rotation on Ubuntu
# snmptrapd.log files as per `systemctl edit snmptrapd.service`
# (in addition to logging traps to syslog)
/var/log/snmptrapd.log
{
rotate 7
daily
missingok
notifempty
delaycompress
compress
@casebeer
casebeer / docker-container-monitor-restart.sh
Last active January 21, 2025 00:56
Ubuntu cron.hourly script to monitor and restart non-running Docker containers
#!/bin/sh
#
# Check on "running" status of critical Docker containers
# and restart them if they are not running.
#
# This is necessary because after a hard host machine reboot, many Docker containers will
# will not start cleanly. Since Docker restart policies and healthchecks only take effect
# once a container has successully started up once, these failed containers will never
# start.
@casebeer
casebeer / docker-run-in-guest.sh
Created October 28, 2024 22:07
Run a host binary in a docker guest using nsenter
#!/bin/bash
# via https://stackoverflow.com/a/53409127
dockerName="${1}"
hostCommandLine="${@:2}"
#nsenter -n -t "$(docker inspect --format {{.State.Pid}} "${dockerName}")" "${@:2}"
nsenter -n -t "$(docker inspect --format {{.State.Pid}} "${dockerName}")" ${hostCommandLine[@]}
@casebeer
casebeer / flush-unbound-zones.sh
Created May 15, 2024 20:34
Flush Unbound DNS local auth-zones and their cached entries after updating zonefiles (and serial numbers).
#!/bin/bash
# set path to directory holding docker-compose.yaml
#dockerComposeRoot=
if [ -z "$dockerComposeRoot" ]; then
echo "ERROR: Set dockerComposeRoot before calling $0" >&2
exit 1
fi
@casebeer
casebeer / thermal-camera-ffmpeg.sh
Last active May 15, 2024 04:33
Script to read data from Tooltop T7 a.k.a. Infiray P2 Pro thermal camera using ffmpeg
#!/bin/bash
# https://www.eevblog.com/forum/thermal-imaging/infiray-and-their-p2-pro-discussion/200/
# https://superuser.com/questions/1009969/how-to-extract-a-frame-out-of-a-video-using-ffmpeg
# https://stackoverflow.com/questions/37960828/webcam-streaming-from-mac-using-ffmpeg
#
# Selected pixel format (yuv420p) is not supported by the input device.
#[avfoundation @ 0x7f961cd08b40] Supported pixel formats:
#[avfoundation @ 0x7f961cd08b40] uyvy422
#[avfoundation @ 0x7f961cd08b40] yuyv422
@casebeer
casebeer / unleashed-nginx.conf
Created May 11, 2024 20:40
Nginx reverse proxy config for Ruckus Unleashed controller w/ backend failover support
#
# Reverse proxy config for Ruckus Unleashed controllers
#
# Requirements:
#
# - DNS entries for all unleashed<IPv4 last octet of controllers>.example.com
# - DNS entry for unleashed.example.com
# - (DNS entries to point to Nginx reverse proxy)
# - Wildcard TLS cert on reverse proxy (or SAN cert covering all above mentioned names)
#
@casebeer
casebeer / ecc-tls-certs.sh
Last active April 25, 2024 04:47
Scripts to generate self-signed ECC TLS certificates with OpenSSL
#!/bin/bash
cat <<EOF > req.template
[req]
#default_bits = 2048
distinguished_name = dn
prompt = no
#req_extensions = req_ext
[dn]
@casebeer
casebeer / luksunlockusb.sh
Last active March 21, 2024 22:19
Script to unlock Ubuntu LUKS encrypted volume from initramfs during boot using a keyfile stored on a USB thumb drive with fallback to manual passphrase entry.
#!/bin/sh
# https://tqdev.com/2022-luks-with-usb-unlock
#
# Script to unlock Ubuntu LUKS encrypted volume from initramfs during boot using
# a keyfile stored on a USB thumb drive with fallback to manual passphrase entry.
#
# Runs in Busybox shell environment in initramfs
# After updates to this script or crypttab, update initramfs:
#