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 / autobrr.service
Last active February 2, 2024 06:52
install autobrr
[Unit]
Description=autobrr service
After=syslog.target network-online.target
[Service]
Type=simple
User=autobrr
Group=media
UMask=002
ExecStart=/var/lib/autobrr/bin/autobrr --config=/var/lib/autobrr
@paul-chambers
paul-chambers / iptv-org-setup.sh
Last active September 4, 2023 01:08
iptv-org sparse checkout
#!/bin/bash
set -x
git clone --no-checkout --depth 1 https://github.com/iptv-org/iptv.git && cd iptv
git config core.sparsecheckout true
cd iptv/streams && git sparse-checkout set us*.m3u ca*.m3u uk*.m3u
@paul-chambers
paul-chambers / README.md
Last active August 7, 2023 12:29
My Control-D & dnsmasq config

These two config files work together to integrate Control-D for public DNS queries and dnsmasq for intranet ones (including those assigned by DHCP).

When these chages are made, the ctrld daemon is 'in front' and receives all queries first on listener.0, irrespective of origin. Listener.0 then diverts any that are for *.local or my intranet to the dnsmasq instance, which has been moved to port 531, to avoid conflicts. If dnsmasq doesn't resolve the request itself internally (i.e. dhcp allocations, /etc/hosts, static dhcp-host configs, etc.), it 'forwards' it back to ctrld on port 532, where listener.1 sends it upstream unconditionally (i.e. listener.1 has no rules to redirect intranet requests to dnsmasq, like there

@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.
@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 / 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 / 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 / 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 / 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 / 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