Skip to content

Instantly share code, notes, and snippets.

View plex-fix-db.sh
#!/bin/bash
# https://gist.github.com/scrathe
# what is this? performs the steps outlined in Plex's garbage instructions on how to "Manually Repair the Database" https://support.plex.tv/articles/repair-a-corrupted-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.
# this script assumes a DOCKER ENVIRONMENT (unRAID and Linuxserver.io Plex docker). modify accordingly to suit your needs.
View radarr-bulk-modify.sh
#!/bin/bash
# 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; https://gist.github.com/scrathe/0bedf625916df1a0d070c053c284017d
RADARR_API_KEY="1234567890"
RADARR_HOST="10.0.0.20"
RADARR_PORT="7878"
View movies-rename-dir.sh
#!/bin/sh
# what is this? identify movies that are named (movie title), THE (year) and rename to (THE movie title) (year)
OLDIFS="$IFS"
IFS=$'\n'
targetDirectories=$(find . -maxdepth 1 -type d -regextype "posix-extended" -regex '.*\,\s(The|the)\s.*' -print | cut -d/ -f 2)
for dir in $targetDirectories; do
View influx-ups.sh
#!/bin/bash
# what is this? poll your UPS using "upsc" and store values using InfluxDB for use with Grafana
# unRAID UPS plugin; https://forums.unraid.net/topic/60217-plugin-nut-v2-network-ups-tools/
# unRAID CA User Scripts; plugin https://forums.unraid.net/topic/48286-plugin-ca-user-scripts/
# unRAID User Scripts; add script, custom schedule = */1 * * * *
command="upsc ups"
influxdb="ups,host=Tower"
@scrathe
scrathe / Plex nvdec enable.sh
Created Mar 16, 2019 — forked from Xaero252/Moved.md
Enable nvdec support for plex dockers on unraid
View Plex nvdec enable.sh
#!/bin/bash
# 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 $?)
View docker-add-apps.sh
#!/bin/bash
# credit; https://forums.unraid.net/topic/69255-cant-access-host-from-docker-container-when-using-br0/?do=findComment&comment=635402
# 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
scrathe / pgl-whitelist.sh
Last active Apr 1, 2018
PeerGuardian Linux (pgl) whitelist cronjob
View pgl-whitelist.sh
# cronjob to monitor domains for IP changes, and add them to PeerGuardian Linux (pgl) whitelist
# https://wiki.archlinux.org/index.php/PeerGuardian_Linux
# sudo crontab -e
# W="list of domains to be whitelisted"
*/30 * * * * W="secure.usenetserver.com eunews.blocknews.net www.usenet-crawler.com nzb.in lolo.sickbeard.com newshost.co.za midgetspy.github.com www.nzbstars.com" ; for H in $W ; do for H_IP in `dig $H A +short | grep -P "^\d.*"` ; do echo "${H}:${H_IP}-255.255.255.255" | tee -a '/etc/pgl/allow.txt' ; done ; done && sort /etc/pgl/allow.txt | uniq > /etc/pgl/allow.p2p && service pgl reload