Skip to content

Instantly share code, notes, and snippets.

@garethgeorge
garethgeorge / diskutil.sh
Created October 12, 2025 04:02
disk management scripts
function diskconnectiontimes() {
lsblk -o NAME | tail -n +2 | while read -r dev; do
# Use `tail -n 1` to get the last log entry, which is the most recent event.
timestamp=$(journalctl --no-pager -k -o short-iso | grep -E "kernel.*${dev}:" | tail -n 1 | awk '{print $1}')
if [[ -n "$timestamp" ]]; then
printf "%s\t%s\n" "$timestamp" "$dev"
fi
done | sort
}
@garethgeorge
garethgeorge / README.md
Created October 7, 2025 00:08
snapraid management scripts

Snapraid Managment Scripts

To use start by formatting your disks to use btrfs. You will divide your disks into parity and data disks. I recommend starting with at least 1 parity disk and any number of data disks (at least 1, but 1 is really a fine place to start if you intend to expand later).

Format your data disks (note the oceandNN naming scheme where the 'd' denotes that it is a data disk and the number is the disk index)

sudo mkfs.btrfs -L oceand01 /dev/sdi1
@garethgeorge
garethgeorge / zpool-healthcheck.sh
Created April 30, 2025 07:52
AI generated script for healthchecking my zpools, just lists zpool status and parses it for any pool in a state other than "ONLINE". Results reported to healthchecks.io
#!/bin/bash
# --- Configuration ---
# Replace this with your actual healthchecks.io ping URL
# (e.g., [https://hc-ping.com/your-uuid)](https://hc-ping.com/your-uuid))
# Do NOT include /fail or /start at the end.
HEALTHCHECKS_URL="YOUR URL HERE"
# --- Script Logic ---
@garethgeorge
garethgeorge / Free-CLA.md
Last active September 4, 2024 18:03
This CLA grants (Gareth George) the patent right to changes and the ability to relicense the work (Backrest) under any FOSS license maintained by the free software foundation.

Fiduciary License Agreement 2.0

Preamble

To summarize the terms of this agreement, this license agreement grants (Gareth George) the patent rights to changes and allows for relicensing under any FOSS license maintained by the free software foundation.

Individual Contributor Exclusive License Agreement

(including the Traditional Patent License OPTION)

@garethgeorge
garethgeorge / .wezterm.lua
Last active November 16, 2024 20:06
My wezterm configuration
local wezterm = require 'wezterm'
local config = wezterm.config_builder()
config.color_scheme = 'Ayu Dark (Gogh)'
-- config.font = wezterm.font 'FiraCode Nerd Font Mono'
config.keys = {
{
key = 'Backspace',
mods = 'CMD',
action = wezterm.action.SendKey { key = 'u', mods = 'CTRL' }
},
@garethgeorge
garethgeorge / main.go
Created June 18, 2024 23:21
A quick and easy CPU based hash generator for the challenge at https://shallenge.quirino.net/
package main
import (
"fmt"
"runtime"
"crypto/sha256"
"encoding/binary"
"encoding/base64"
"encoding/hex"
"math/bits"
@garethgeorge
garethgeorge / parallelgzip.go
Created May 17, 2024 23:27
A golang implementation of a parallel gzip writer. Parallelizes the gzip compression of a stream of data in 1MB chunks.
type PgzipWriter struct {
w io.Writer
level int
chunkSize int
buf []byte
segments chan chan []byte
err atomic.Pointer[error]
}
@garethgeorge
garethgeorge / zfs-decrypt-disks.py
Last active August 11, 2022 02:18
A script for my NAS to load an encryption key and mount all available ZFS volume with that key. Can accept password from stdin or will run a simple flask server to accept the password from a web form.
import hashlib
import os
import json
import subprocess
import argparse
from threading import Thread
from time import sleep
from flask import Flask, request
parser = argparse.ArgumentParser(description="Decrypts all available ZFS encrypted volumes")
@garethgeorge
garethgeorge / prune-zsys-snapshots.py
Created August 3, 2021 04:50
Prune autozsys snapshots produced by zsysctl on linux with zfs on root
from collections import namedtuple
import subprocess
import itertools
import argparse
import time
Snapshot = namedtuple("Snapshot", ["dataset", "snapshot"])
def parse_snapshot(snapshot):
@garethgeorge
garethgeorge / README.md
Last active December 31, 2020 21:37
a python script to generate evenly spaced screenshots of a video for the purpose of ab testing the quality of a video encode

Video AB Test

Script uses ffmpeg to extract frames from video for A/B comparison of encoder quality / settings. The script will extract frames at some specified interval and output them with randomized names. mapping.txt will contain the mapping between the source files and the output naming scheme allowing the user to objectively determine which encoding settings produced the best looking output.