Skip to content

Instantly share code, notes, and snippets.

View paulreece42's full-sized avatar
🤠

Paul Reece paulreece42

🤠
View GitHub Profile
@paulreece42
paulreece42 / mymariabackup.sh
Last active October 5, 2025 15:06
quick simple mariadb backup
#!/bin/bash
#
# 2025-10-05: Paul Reece <paulreece42@gmail.com>, initial wite
#
# Take a backup of MariaDB
#
# Note: I wrote this in under a couple hours, without using AI... keep an eye on it
# make sure it runs, use proper monitoring, etc
#
# Requires zstd, or "zstandard" compression tool
@paulreece42
paulreece42 / netmount_remounter.sh
Created September 8, 2025 16:37
netmount_unmounter.sh
#!/bin/bash
#
# NFS Unhanger
#
# Takes mounted filesystems from /proc/mounts
# Tries to df them in background
# If cannot in $TIMEOUT secs, kill and lazy unmount and try to remount
# If cannot remount, add to failed list
# Finally, retry re-mounting previously failed mounts, again with timeout
# Fin
#!/bin/env python3
#
# Gets the estimated space usage of prometheus
#
# usage: /opt/prom_calc.py 1y [optional number of samples per sec]
# y = years
# m = months
# d = days
#
# If number of samples not provided, queries from prometheus on prometheus.mydomain.com:9090
@paulreece42
paulreece42 / crontab-example.txt
Created June 9, 2025 15:09
ZFS Operational Prometheus node_exporter Stats
# Match to your prometheus node_exporter --collector.textfile.directory
# add "sponge" commmand inline if needed, probably isn't here
# Replace pool0 with the pool you wish to monitor
* * * * * root /opt/zfs_space_used.sh pool0 > /var/tmp/node_exporter/zfs_space.prom
* * * * * root /opt/zpool_status_simple.sh pool0 > /var/tmp/node_exporter/zfs_status.prom
@paulreece42
paulreece42 / 00why_tape.md
Last active November 3, 2025 15:40
Notes for working with LTO tape

So, "Why Tape!?"

Or: "I thought tape was dead?"

Me too, before I started using it just recently, in the Year of our Lord, 2025, and absolutely fell in love with it

Consider the following:

@paulreece42
paulreece42 / encode_hls.sh
Created March 21, 2023 22:54
ffmpeg transcode to HLS resolution
#!/bin/bash
# usage: ./encode_hls.sh video.mp4 480
#
# Transcode to HLS @ XXXXp
#
# Simple little script I made, requires jq and ffmpeg
# I just use the ffmpeg from https://johnvansickle.com/ffmpeg/
#
export INPUTFILE=$1
@paulreece42
paulreece42 / san cert with ca
Created July 20, 2017 19:54
SAN Certificate self-signed by own CA, good (in theory, but untested) for k8s etc
## BEGIN san.cnf ##
[ req ]
default_bits = 2048
distinguished_name = req_distinguished_name
req_extensions = v3_req
prompt = no
[ req_distinguished_name ]
commonName = foo.bar
[ v3_req ]
subjectAltName = @alt_names
@paulreece42
paulreece42 / gist:9002883
Last active May 25, 2021 09:10
pmacct with origin ASN without BGP
#
# Background: this was done on a CentOS 6.5 ESXi VM running pmacct 1.5.0rc2 and PostgreSQL 9.3 from PGDG repo with
# the following config line for pmacct:
#
# ./configure --enable-pgsql --enable-geoip --enable-ipv6 --with-pgsql-libs=/usr/pgsql-9.3/lib --with-pgsql-includes=/usr/pgsql-9.3/include
#
#
# I also customized the table they used in postgres to add vertical partitioning, but that's another gist :)
#