Skip to content

Instantly share code, notes, and snippets.

View paul-chambers's full-sized avatar
💭
Open to new opportunities

Paul Chambers paul-chambers

💭
Open to new opportunities
View GitHub Profile
@paul-chambers
paul-chambers / torrent-complete
Last active November 6, 2024 14:01
Helper script for deluge or qBittorrent. It hardlinks completed torrents into a destination folder. It also unrars it, if it includes a rar archive.
#!/bin/bash
# Helper script for deluge or qBittorrent bittorrent clients
# Intended to be run when the torrent download completes
#
# for qBittorrent, enable 'Run external program on torrent completion' under 'Downloads' in the options dialog.
# in the text field, enter:
#
# <path to>/torrent-complete.sh "%K" "%N" "%D"
#
@paul-chambers
paul-chambers / traefik.service
Created February 25, 2019 04:14
If you're not running traefik using docker, you might want a systemd service file for it.
#
# assumes you have a user called 'traefik', with the home directory '/var/lib/traefik',
# containing the 'traefik' executable and a 'trafik.toml' configuration file.
## adduser --system --shell /sbin/nologin --home /var/lib/traefik traefik
#
[Unit]
Description=Traefik
Documentation=https://docs.traefik.io
After=network-online.target
@paul-chambers
paul-chambers / keybase.md
Created March 2, 2019 07:11
Keybase authentication

Keybase proof

I hereby claim:

  • I am paul-chambers on github.
  • I am paulchambers (https://keybase.io/paulchambers) on keybase.
  • I have a public key ASCurpxOID6GqlcTvchnLxQDIIfVcFWcAdKsLtiFuoqKZwo

To claim this, I am signing this object:

@paul-chambers
paul-chambers / MakeMKV auto config
Last active September 6, 2020 05:37
Automation of my preferred selection of streams
+sel:all,-sel:(audio|subtitle)&!(favlang|nolang|single),=100:all,-10:favlang
@paul-chambers
paul-chambers / miniupnp-repo-split
Created October 28, 2019 02:48
Short script to split the miniupnp/miniupnp repo into three - miniupnpc, miniupnpd, and minissdpd
#!/bin/bash
set -x
USER=miniupnp
PROJECT=miniupnp
repo=https://github.com/${USER}/${PROJECT}.git
if [ -d "${PROJECT}" ]; then
rm -rf "${PROJECT}"
fi
@paul-chambers
paul-chambers / passthru-nvidia-to-lxc.sh
Last active May 20, 2024 10:11
nvidia GPU passthru to an LXC container (for Debian)
#!/bin/bash
# In both host and container, add the nVidia repros (see https://nvidia.github.io/nvidia-container-runtime/)
set -x
which curl > /dev/null || apt install curl
# add the repo key:
curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | sudo apt-key add -
# add the 'nvidia container runtime' repo to apt's sources
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
@paul-chambers
paul-chambers / cleanup.sh
Created January 3, 2020 00:36
Cleans up cruft that accumulates in some of my media folders
#!/bin/bash
set -x
dir="${1:-./}"
if [ ! -z "${dir}" ]
then
find "${dir}" -regex '.*[\.-_][Ss]ample[\.-_].*' -delete
find "${dir}" -regex '.*proof.*\.jpg' -delete
find "${dir}" -regex '.*\/screen[0-9]+\.png' -delete
find "${dir}" -regex '.*\.\(exe\|idx\|nfo\|lnk\|nzb\|sfv\|srr\|srs\|srt\|sub\|sup\|txt\|url\)' -delete
@paul-chambers
paul-chambers / crop-black-bars.sh
Last active April 16, 2024 12:49
A little ffmpeg magic to remove those annoying black bars that studios insist on encoding into the media.
#!/bin/bash
# a script that uses ffmpeg to detect the 'black bars' that are sometimes encoded into the video and then
# reencodes the video stream (only) to remove them and restore the content's original aspect ratio.
# if the original video codec used was MPEG2 or h264, it also re-encodes it to libx264.
input="${1}"
output="${input%.*}.crop.${input##*.}"
# scan 5 seconds of video, starting one minute in, to autodetect the cropping dimensions to use
@paul-chambers
paul-chambers / dhclient-enter-hooks.d
Last active January 12, 2023 05:45
/etc/dhcp/dhclient-enter-hooks.d
Some custom Scripts to update things that depend on the WAN IP address
@paul-chambers
paul-chambers / update-country-ipsets.sh
Created August 5, 2023 07:50
Script to pull country-specific IP ranges from ipdeny.com and create/update country-specific ipsets from them
#!/bin/bash
#
# Powered by <a href="http://www.ipdeny.com">IPDENY.COM</a> IP database.
#
# Pull the agregated zone lists from denyip.com, and create country-specific ipsets from them
#
# This approach doesn't require an additional 'geoip' kernel module or the Maxmind database.
#
# When updating, the new ipset replaces the existing one with a 'swap', so there isn't any
# time period when the set is empty.