Skip to content

Instantly share code, notes, and snippets.

View hanthor's full-sized avatar

James Reilly hanthor

View GitHub Profile
@hanthor
hanthor / libvirt-home-bindmount.sh
Created June 21, 2025 10:01
bindmount var/lib/libvirt
#!/bin/bash
# This script sets up a systemd bind mount for libvirt data from /var/home/var-lib-libvirt to /var/lib/libvirt.
# --- Configuration ---
SOURCE_DIR="/var/home/var-lib-libvirt"
TARGET_DIR="/var/lib/libvirt"
MOUNT_UNIT_NAME="var-lib-libvirt.mount" # Derived from TARGET_DIR: /var/lib/libvirt -> var-lib-libvirt.mount
MOUNT_UNIT_FILE="/etc/systemd/system/${MOUNT_UNIT_NAME}"
LIBVIRT_SERVICES=("virtlogd" "libvirtd") # Services to stop/start
@hanthor
hanthor / ts-exit-node.sh
Created May 18, 2025 13:23
speedy tailscale exit node picker
#!/bin/bash
# Tailscale exit node picker
ERROR_TEXT="..this should not have happned please report a bug at https://github.com/ublue-os/packages"
# --- Prerequisite Checks ---
if ! command -v gum &> /dev/null; then
echo "gum could not be found. Please install gum: https://github.com/charmbracelet/gum"
exit 1
@hanthor
hanthor / gist:1b5fff5bce296adfe2139999f97c115d
Created December 14, 2024 08:15
Updated script to migrate /var to ZFS pool with encryption
#!/bin/bash
# Create a new ZFS dataset for /var with encryption
sudo zfs create -o encryption=on -o keyformat=passphrase mypool/var
# Set the mountpoint for the new dataset
sudo zfs set mountpoint=/var mypool/var
# Backup the current /var directory
sudo rsync -av /var/ /var_backup/
@hanthor
hanthor / gist:cd12d8d0bb9665ef4ae69fb3b4946be5
Created December 14, 2024 08:13
Script to migrate /var to ZFS pool
#!/bin/bash
# Create a new ZFS dataset for /var
sudo zfs create mypool/var
# Set the mountpoint for the new dataset
sudo zfs set mountpoint=/var mypool/var
# Enable ZFS native encryption on the dataset
sudo zfs create -o encryption=on -o keyformat=passphrase mypool/var
@hanthor
hanthor / gist:ce09bbf88da1292bb474d716d54e5d53
Created December 14, 2024 08:13
Script to revert /var migration to ZFS pool
#!/bin/bash
# Unmount the ZFS dataset from /var
echo "Unmounting ZFS dataset from /var..."
sudo umount /var
# Backup fstab
echo "Backing up /etc/fstab to /etc/fstab.bak..."
sudo cp /etc/fstab /etc/fstab.bak
@hanthor
hanthor / install-bootc-notifier.sh
Created December 14, 2024 05:36
Updated bootc update notifier script with Reboot Now button
#!/bin/bash
# --- Script Installation ---
# Install jq if it's not already installed
if ! command -v jq &> /dev/null; then
echo "jq is not installed. Installing..."
brew install jq # Or use your distribution's package manager
fi
#!/bin/bash
# Create necessary directories
mkdir -p ~/.local/bin
mkdir -p ~/.local/share/systemd/user
# Write the script content to ~/.local/bin/switch_tuned_profile.sh
cat << 'EOF' > ~/.local/bin/switch_tuned_profile.sh
#!/bin/bash
@hanthor
hanthor / pve_vm_preboot.sh
Last active August 17, 2024 13:55
Proxmox Preboot password sending via NoVNC
#!/bin/bash
# Check if a string is passed as an argument if not prompt user for it
if [ -z "$1" ]; then
echo "Usage: $0 <string_to_send>"
read -p "Enter the string to send: " string_to_send
else
string_to_send="$1"
fi
@hanthor
hanthor / gist:cd760dfbc0567f5f7439d422d00b5e1c
Last active February 8, 2022 21:07
email-subscribe.html
<iframe class="mj-w-res-iframe" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://app.mailjet.com/widget/iframe/7zeY/M6w" width="100%"></iframe>
<script type="text/javascript" src="https://app.mailjet.com/statics/js/iframeResizer.min.js"></script>

Keybase proof

I hereby claim:

  • I am hanthor on github.
  • I am jreilly112 (https://keybase.io/jreilly112) on keybase.
  • I have a public key ASAgkztPN-tBf06pcH_U4oWFiUGEoqsHAZvU7wyn4q1Fwwo

To claim this, I am signing this object: