Skip to content

Instantly share code, notes, and snippets.

View bigntallmike's full-sized avatar

Michael T. Babcock bigntallmike

View GitHub Profile
@bigntallmike
bigntallmike / smartsummary.py
Last active October 1, 2026 16:28
Summarize SMART data on multi-drive systems
#!/usr/bin/env python3
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so.
#
# Written by Michael T. Babcock + Google Antigravity
@bigntallmike
bigntallmike / toolcaches.json
Created July 19, 2026 03:25
[Used LLM] A possible format for sharing how to clear space used by random common tools, generated by Gemini.
{
"_comment_manifest": "DEVELOPER TOOL STORAGE MANIFEST: This JSON file lists common CLI tools, their cache/temporary directory paths across different Operating Systems, and official clear commands.",
"schema_version": "1.0",
"tools": [
{
"id": "uv",
"name": "uv (Astral)",
"description": "An extremely fast Python package installer and resolver, written in Rust.",
"_comment_tool": "uv heavily relies on caching to achieve its performance. Its cache is content-addressed.",
"storage": [
@bigntallmike
bigntallmike / borgusbbackup
Created February 16, 2026 01:34
Alternative borg backup script
#!/bin/sh
# This script is intended to be saved on a removable drive
# and executed in place when that drive is mounted properly
# For instance:
# ./borgusbbackup oldlaptop /home /etc
DATECODE=$(date +%Y%m%d%H%M%S)
if [ "x$1" = "x" ]; then
echo "Specify name of backup then folders to back up ..."
@bigntallmike
bigntallmike / borgbackup.sh
Last active January 16, 2026 18:35
Personal borg backup script
#!/bin/sh
#
# Obviously substitute for your own:
TARGET="backups@backups:/backups"
# Contains BORG_REPO and BORG_PASSPHRASE, and optionally KEEP_n options seen below
. $HOME/.config/netborgbackup
export BORG_PASSPHRASE
@bigntallmike
bigntallmike / immich_ml_raw.sh
Created December 16, 2025 20:12
Quick script to run immich machine learning without docker
#!/bin/sh
#
# Install immich and required libraries to run on bare metal with RHEL/Fedora
sudo dnf -y install \
python3-fastapi \
python3-huggingface-hub \
python3-opencv \
python3-orjson \
python3-pip \
@bigntallmike
bigntallmike / gist:f43eda5dbc4b93e74fa0bab988cdf844
Created September 2, 2025 20:14
Convert tinydns to hosts format
# Use this as you will, its imperfect, but generates a decent /etc/hosts file on stdout
with open("/var/lib/tinydns/root/data", "r") as tinydnsdata:
for line in tinydnsdata:
if line[:1] == "=":
hostname, ip = line[1:].split(":")
print(f"{ip.strip()}\t{hostname}")
#!/usr/bin/python3
#
# We want to open the file specified and read the data out of it.
import sys
def old_way(filename):
fd = open(filename)
if not fd:
print("error of some kind")
sys.exit(1)
#!/usr/bin/python3
#
# Instead of just typing:
print("hello world")
# Do this (main is a placeholder; the actual thing it does is better):
def main():
@bigntallmike
bigntallmike / gist:0624858d4eead91d90baebfee4dcb94d
Last active November 17, 2023 22:11
Steps to reinstall RPMs with zero-length libraries
# With root file system mounted at /oldsys:
# Use at own risk!!
find /oldsys/usr/lib -size 0 >/tmp/badlibs
cat /tmp/badlibs \
| xargs --replace={} rpm --root /oldsys -qf "{}" \
| grep -v "not owned" \
| sort \
| uniq \
| xargs dnf -y --installroot=/oldsys reinstall
@bigntallmike
bigntallmike / procnetdata.py
Last active January 2, 2023 19:14
Wrote a quick class to parse /proc/net/dev data
#!/usr/bin/python3 -ttu
#
# Class to read and parse /proc/net/dev quickly and make the data available as a dictionary
# and/or json.
#
# Licensed: MIT. Just use it. Technically Copyright (C) 2022 Michael T. Babcock
from collections import OrderedDict
import re