Skip to content

Instantly share code, notes, and snippets.

@andrebrait
andrebrait / uos-supervisor-cert-fix.sh
Created July 19, 2026 18:33
UniFi OS Server: diagnose & fix updates failing due to internal cert missing a 127.0.0.1 SAN (custom cert clobbered unifi-core.crt)
#!/usr/bin/env bash
#
# uos-supervisor-cert-fix.sh
#
# UniFi OS Server: diagnose and fix "update keeps failing" caused by a custom
# TLS certificate having been written over the INTERNAL cert (unifi-core.crt).
#
# The supervisor / update control channel connects to the core over loopback
# (https://127.0.0.1:<supervisor-port>) with strict TLS hostname verification.
# The internal cert must therefore carry a 127.0.0.1 SAN. When a user installs a
@andrebrait
andrebrait / hook_post_haproxy.sh
Last active July 22, 2026 21:46
pfBlockerNG post-update hook for usage of aliases inside HAProxy ACLs
#!/bin/sh
# Install as /usr/local/pkg/pfblockerng/hooks/hook_post_haproxy.sh so it appears in the Hooks GUI (pfBlockerNG >= 4.0.0)
# We are not using pfBlockerNG's modification flags because HAProxy may be out of sync even though nothing changed in *this* update via pfBlockerNG
if [ "$PFB_PRE_UNINSTALL" -gt 0 ]; then
echo "Skipping update on uninstall..."
exit 0
fi
@andrebrait
andrebrait / install-qemu-agent.sh
Last active June 4, 2026 07:24
Install and enable QEMU Guest Agent on pfSense on boot
#!/bin/sh
# Install qemu-guest-agent
pkg update
pkg install -y qemu-guest-agent
# Enable it in rc.conf.local
cat > /etc/rc.conf.local << EOF
qemu_guest_agent_enable="YES"
qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"
@andrebrait
andrebrait / Dockerfile
Last active June 2, 2026 00:14
SFTPGo - Data Retention Policy send email for data retention policy and manual trigger
FROM python:3.14.5-slim
WORKDIR /app
RUN pip install --no-cache-dir fastapi uvicorn
COPY relay.py .
CMD ["uvicorn", "relay:app", "--host", "127.0.0.1", "--port", "8099"]
@andrebrait
andrebrait / arcane-migrate.sh
Last active June 1, 2026 15:52
Arcane bidirectional migrator
#!/usr/bin/env bash
set -euo pipefail
# ╔══════════════════════════════════════════════════════════════════════════╗
# β•‘ Arcane bidirectional migrator β•‘
# β•‘ β•‘
# β•‘ ── DISCLAIMER ── β•‘
# β•‘ This script was generated by Claude (an AI assistant by Anthropic) in β•‘
# β•‘ collaboration with the user. It is NOT an official Arcane tool and is β•‘
# β•‘ not affiliated with or endorsed by the Arcane project (getarcaneapp). β•‘
@andrebrait
andrebrait / hook_post_haproxy.sh
Last active July 24, 2026 10:34
Synchronize IP aliases from pfBlockerNG with HAProxy
#!/bin/sh
# Drop this script in /usr/local/pkg/pfblockerng/hooks
if [ "$PFB_PRE_UNINSTALL" -gt 0 ]; then
echo "Skipping update on uninstall..."
exit 0
fi
# SIMPLE PID GUARD: Exit if this script is already running elsewhere
@andrebrait
andrebrait / 0-create-macvlan-ipv6.sh
Last active May 16, 2026 09:27
Set fixed IPv4 and optional fixed IPv6 using netplan with systemd-networkd that actually works
#/bin/sh
docker network create -d macvlan \
--subnet=10.255.0.0/16 --gateway=10.255.0.1 \
--ipv6 \
--subnet=fd00:abba::/32 --gateway=fd00:abba::1 \
-o parent=ens18 \
-o macvlan_mode=bridge firewall-macvlan
@andrebrait
andrebrait / uosserver-healthcheck.service
Last active May 22, 2026 10:41
UOS Server Health Check - Restart upon failed startup
# Copy this file to /etc/systemd/system/ and run `systemctl enable uosserver-healthcheck`
[Unit]
Description=Unifi UOS Server Healthcheck
After=uosserver.service
[Service]
Type=oneshot
ExecStartPre=/bin/sleep 30s
ExecStart=/bin/uosserver-healthcheck
@andrebrait
andrebrait / power.service
Last active October 23, 2025 02:42
Enable Power-saving features for Intel-based servers running Linux
# This enabled the power settings present in the script
# >> Skip this file for unRAID, since it does not use systemd <<
# Put this file in /etc/systemd/system/power.service
# Then manually run it, 'systemctl start power'
# Check the output with 'systemctl status power'
# Then enable it with 'systemctl enable power'
[Unit]
@andrebrait
andrebrait / disable-nic-offload-e1000e.service
Last active May 13, 2025 17:08
Disable e1000e offloading for Proxmox VE and unRAID
# This prevents the freeze with the message 'e1000e eno1: Detected Hardware Unit Hang'
# >> Skip this file for unRAID, since it does not use systemd <<
# Put this file in /etc/systemd/system/disable-nic-offload-e1000e.service
# Then manually run it, 'systemctl start disable-nic-offload-e1000e'
# Check the output with 'systemctl status disable-nic-offload-e1000e'
# Then enable it with 'systemctl enable disable-nic-offload-e1000e'