Skip to content

Instantly share code, notes, and snippets.

View andrebrait's full-sized avatar

Andre Brait andrebrait

View GitHub Profile
@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 / compose.yaml
Last active June 2, 2026 08:16
rclone - reconciliation process for a DVR with Docker compose
# Periodic reconciliation sweep: copies any source footage MISSING on the backup,
# over SFTP, on an interval. Backstop for the per-upload push when the backup was
# unavailable for a while. COPY ONLY (never sync) — it never deletes from the
# backup, so the backup's own (longer) retention stays in sole control of trimming.
#
# Add this service to your existing docker-compose.yml on the PRIMARY host.
#
# Uses the official rclone image with an SFTP remote configured via environment
# variables (RCLONE_CONFIG_<REMOTE>_*), so there's no config file to manage.
# The remote here is named "backup".
@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]