Skip to content

Instantly share code, notes, and snippets.

@brwyatt
brwyatt / Create_Render_LXC.md
Created April 23, 2025 03:01
Create Render LXC in Proxmox

Create a Render LXC in Proxmox

Instructions to setup a dedicated rendering LXC for Jellyfin. Useful for running Jellyfin in a VM and without passing through the whole iGPU, instead passing off to LXCs, allowing using more than one Proxmox host in the cluster for rendering.

Sources

Hardware

  • Minisforum MS-01

Workaround for missing default route on Proxmox boot

Have an issue where Proxmox, on boot, fails to set the default route. It is set in the config (file and UI), and changing the gateway and applying will set the default route, so something's getting mixed up here. So hopefully this fixes it.

Replace 172.17.25.1 with your gateway, and vlan25 with the correct interface.

Script

file: /usr/local/bin/fix-default-route.sh

Installing HAProxy with Certbot

Largely taken from this tutorial, which was hilariously out of date

Install HA Proxy

sudo apt install haproxy

Install Certbot

#!/bin/bash
ip=""
ping="NO"
dns=()
timeout=1
while [[ $# -gt 0 ]]; do
case $1 in
-p|--ping)
@brwyatt
brwyatt / ui_stock_check.sh
Last active January 28, 2023 01:05
Ubiquiti Store stock checker
#!/bin/bash
models=(
"switch-enterprise-8-poe"
"usw-enterprise-24-poe"
"usw-enterprise-48-poe"
"usp-rps"
)
do_check () {
@brwyatt
brwyatt / git_puppet_count.sh
Created December 29, 2018 23:29
Script to count the lines of Puppet code for each commit in a Git repo
#!/bin/bash
file="/tmp/count.csv"
echo "datetime,commit,lines" > "${file}"
for i in $(git log --pretty='%ct:%H'); do
d=$(echo "${i}"|cut -f1 -d':')
c=$(echo "${i}"|cut -f2 -d':')
@brwyatt
brwyatt / ssh_proxy.sh
Created June 1, 2017 05:48
Bash script to automatically proxy SSH connections through a proxy host when off-network
#!/bin/bash
# Put the following in the `~/.ssh/config` for each host to
# conditionally proxy:
# ProxyCommand ssh_proxy.sh %h %p bastion.example.net
if [ $# -ne 3 ]; then
echo "USAGE: $0 HOST PORT PROXYHOST" >&2
exit 99
fi
#!/bin/bash
servers=()
unset input
read -p "Server ${#servers[@]}: " input
while [ ${#servers[@]} -eq 0 ] || [[ "x${input}" != "x" ]]; do
if [[ "x${input}" != "x" ]]; then
servers=("${servers[@]}" $input)
fi
unset input
@brwyatt
brwyatt / nukeAllCephOSDs.sh
Created July 11, 2016 03:26
Script to out, stop, and remove all (unencrypted) Ceph OSDs and partitions from a system
#!/bin/bash
osds=($(systemctl list-units | grep -iE 'ceph-osd@[[:digit:]]+\.service' | tr -s ' ' | cut -f2 -d' ' | cut -f2 -d'@' | cut -f1 -d'.'))
for i in "${osds[@]}"; do
echo "***Outing OSD $i"
ceph osd out $i
done
read -p "***Pausing for replication/recovery. Press [ENTER] when done..." $DONE
@brwyatt
brwyatt / findNewestFile.sh
Last active January 22, 2025 19:20
BASH script to find the newest file under a directory structure
#!/bin/bash
if [[ "x${1}" == "x" ]]; then
dir="."
else
dir="${1}"
fi
# Based on https://stackoverflow.com/questions/10575665/linux-find-command-find-10-latest-files-recursively-regardless-of-time-span
# with additions to return only the date of the newest file