Skip to content

Instantly share code, notes, and snippets.

scrathe /
Last active October 29, 2022 15:35
Removes restriction on maximum number of simultaneous NVENC video encoding sessions imposed by Nvidia to consumer-grade GPUs.
# run from unraid shell. not inside plex docker.
# where do you want to store the script?
# download patch source:
wget -O $dst
# what is this? performs the steps outlined in Plex's garbage instructions on how to "Manually Repair the Database"
# notes
# although this script will backup your Plex DB, i would suggest making your own backup.
# this script assumes you are comfortable with copying/pasting/running random things from the internet.
# what is this? query your Radarr library and make changes via the API.
# in this example we query all Radarr entries, identify movies that are named (movie title), THE (year) and update the .path and .folderName to (THE movie title) (year)
# after updating Radarr, rename the folders on the filesystem;
# what is this? identify movies that are named (movie title), THE (year) and rename to (THE movie title) (year)
targetDirectories=$(find . -maxdepth 1 -type d -regextype "posix-extended" -regex '.*\,\s(The|the)\s.*' -print | cut -d/ -f 2)
for dir in $targetDirectories; do
# what is this? poll your UPS using "upsc" and store values using InfluxDB for use with Grafana
# unRAID UPS plugin;
# unRAID CA User Scripts; plugin
# unRAID User Scripts; add script, custom schedule = */1 * * * *
command="upsc ups"
scrathe / Plex nvdec
Created March 16, 2019 19:24 — forked from Xaero252/
Enable nvdec support for plex dockers on unraid
View Plex nvdec
# This should always return the name of the docker container running plex - assuming a single plex docker on the system.
con="$(docker ps --format "{{.Names}}" | grep -i plex)"
echo -n "<b>Applying hardware decode patch... </b>"
# Check to see if Plex Transcoder2 Exists first.
exists=$(docker exec -i "$con" stat "/usr/lib/plexmediaserver/Plex Transcoder2" >/dev/null 2>&1; echo $?)
# credit;
# note: the path to the script must be accessible from within the docker shell
# option 1) run from inside the docker shell (do this first to make sure it works)
# option 2) run-as unraid user-script scheduled on-first-array-start-only (run once in background to avoid unraid reboot)
# nohup docker events --filter "container=plex" | awk '/container start/ { system("docker exec -i plex /bin/bash -c '/media/scripts/docker-plexencode/script'") }' &
scrathe /
Last active October 29, 2022 15:40
PeerGuardian Linux (pgl) allowlist cronjob
# cronjob to monitor domains for IP changes, and add them to PeerGuardian Linux (pgl) allowlist
# sudo crontab -e
# W="list of domains to be allowed"
*/30 * * * * W=" site.two site.three" ; for H in $W ; do for H_IP in `dig $H A +short | grep -P "^\d.*"` ; do echo "${H}:${H_IP}-" | tee -a '/etc/pgl/allow.txt' ; done ; done && sort /etc/pgl/allow.txt | uniq > /etc/pgl/allow.p2p && service pgl reload