Skip to content

Instantly share code, notes, and snippets.

View ataylor-us's full-sized avatar

Alex Taylor ataylor-us

View GitHub Profile
{#
This was my gaming/GPU Windows 11 passthrough libvirt vm. It's templated in jinja2 for use with Ansible.
I retired it in October 2024.
Arch Linux was the host, and I switched between using the stable and LTS Linux Kernel depending on updates.
The rest of of Ansible repo (including the variables) has since been retired, but I made a point to document things as I tweaked them.
@ataylor-us
ataylor-us / conflict-find.sh
Created February 12, 2024 02:37
This is an old script (4-5 years ago) I had in my crontab to find sync-conflicts from a Syncthing folder. It would send it to my local mail by default (or wherever cron mails to)
#!/bin/bash
SYNCDIR=~/Sync
LOGFILE=~/sync-conflicts.log
find $SYNCDIR -name "*sync-conflict*" > $LOGFILE
find ~/ -maxdepth 1 -type f -size 0 -name "sync-conflicts" -exec rm {} \;
@ataylor-us
ataylor-us / driveCleaner.sh
Created January 23, 2024 20:19
Used this to wipe & get the smart data for my drives before storage/giving away
#!/bin/bash
LOGFILE=$(udevadm info --query=all --name=$1 | grep ID_SERIAL= | cut -c 14-)
wipefs -a "$1" && \
dd if=/dev/urandom of="$1" status=progress bs=4096 ; \
smartctl -a "$1" >> "$LOGFILE".txt
#!/bin/bash
diary () {
PAGE=~/Obsidian/Notes/Attachments/Diary/$(date +%F).gpg
if [ -f "$PAGE" ](%20-f%20"$PAGE"%20); then
nvim -c 'set spell' "$PAGE"
else
echo "New page, copying template."
cp ~/Obsidian/Notes/Attachments/Diary/template.gpg "$PAGE" >> /dev/null
nvim -c 'set spell' "$PAGE"
fi
@ataylor-us
ataylor-us / dynamic-dns.sh
Created January 6, 2024 12:10
ddns script prepared for a Nextcloud hosting presentation back in 2021
#!/bin/bash
# This is a silly little script I wrote to automatically update my NameCheap dynamic dns. I just wanted an alternative to the ddclient container I was using.
# It should be able to handle some errors, there's a grep to get the IP address only, as well as a check to make sure it's between the character range. Not much else though, its literally an 11 line shell script, lmao.
# Just edit the `DOMAIN` and `PASSWORD` enviornment variables in the script and throw it in your crontab.
DOMAIN=""
PASSWORD=""
HOST="@"
IP="$(curl -s https://dynamicdns.park-your-domain.com/getip 2>/dev/null | grep --colour=never -E -o '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)')"
if [ "$(echo $IP | wc -c)" -le "15" ] && [ "$(echo $IP | wc -c)" -ge "7" ]; then
curl -s https://dynamicdns.park-your-domain.com/update\?host\="$HOST"\&domain\="$DOMAIN"\&password\="$PASSWORD"\&ip\="$IP" | grep --colour=never
@ataylor-us
ataylor-us / update-checker.sh
Created January 5, 2024 04:27
This is an update checker I had in on some of my machines. It would just get put in my crontab, and run daily.
#!/bin/bash
OSREL=$(grep -w ID /etc/os-release)
SUBJECT="Updated Packages on $(cat /etc/hostname)"
if [ "$OSREL" = "ID=arch" ]; then
yay -Sy >> /dev/null
BODY=$(yay -Qu)
fi
if [ "$OSREL" = "ID=debian" ]; then
apt update &> /dev/null
BODY=$(apt list --upgradable 2> /dev/null | grep -v '^Listing...')