Skip to content

Instantly share code, notes, and snippets.

@jfeilbach
jfeilbach / build.sh
Created Jan 21, 2021
build netifaces .whl
View build.sh
#!/bin/bash
git clone https://github.com/al45tair/netifaces.git /wheel/netifaces
/opt/python/cp39-cp39/bin/pip wheel /wheel/netifaces -w /tmp
auditwheel repair /tmp/netifaces-0.10.9-cp39-cp39-linux_x86_64.whl -w /output
# docker run -v "$(pwd)":/output quay.io/pypa/manylinux1_x86_64 /output/build.bash && pip install *.whl
@jfeilbach
jfeilbach / transmission-openvpn.sh
Last active Jun 14, 2021
docker pull, stop container, rm container, rotate log file, backup config, start new image as container, add dig, check public ip address
View transmission-openvpn.sh
#!/bin/bash
name=transmission-openvpn
echo "Stopping ${name}"
/usr/bin/docker stop transmission-openvpn
echo "Removing ${name}"
/usr/bin/docker rm transmission-openvpn
# rotate the log file
#mv -v /dl_2/transmission-home/transmission.log /dl_2/transmission-home/transmission.log.$(date +%Y%m%d)
@jfeilbach
jfeilbach / backup_jackett.sh
Last active Jan 5, 2021
simple backup script for Jackett config running in docker
View backup_jackett.sh
#!/bin/bash
# I misspelled Jackett when I mapped the docker vol, oops
work_dir=/'opt/docker/jacket_config/Jackett'
# Use Sonarr/Radarr backup date format
date=$(date +%Y.%d.%m_%H.%M.%S)
# This works on the linuxserver.io docker image
ver=$(docker exec -it jackett /app/Jackett/jackett --version | head -n 1 | awk '{ print $2 }' | tr -d '\r')
/usr/bin/zip -r \
${HOME}/jackett_backup_${ver}_${date}.zip \
@jfeilbach
jfeilbach / sysctl.conf.md
Last active Jul 27, 2022
10/40 Gb NIC Linux Kernel Performance Tuning for samba file server
View sysctl.conf.md

TCP tuning

The most important TCP tuning areas since kernel 4.9 are:

  • packet pacing
  • dynamic TSO sizing
  • TCP small queues
  • BBR TCP congestion algorithm

Definitions

  • Gb = gigabit
@jfeilbach
jfeilbach / search_trans.sh
Last active Nov 11, 2020
search for string e.g. tracker.example.com and move torrent via samba to new client
View search_trans.sh
#!/bin/bash
NC='\033[0m' # No color
Green='\033[0;32m' # Green
White='\033[0;37m' # White
Red='\033[0;31m' # Red
Yellow='\033[0;33m' # Yellow
id=${1}
remote_host=uhura.local:9091
@jfeilbach
jfeilbach / purge.sh
Created Nov 8, 2020
Purge old torrents from host
View purge.sh
#!/bin/bash
NC='\033[0m' # No color
Green='\033[0;32m' # Green
White='\033[0;37m' # White
Red='\033[0;31m' # Red
check=$(/usr/bin/transmission-remote uhura.local:9091 -l | grep 'Stopped' | awk '{ ORS=" " } ; { print $1 }')
usage=$(df -h |grep dl | awk '{ print $5,$6 }')
for x in ${check} ; do
@jfeilbach
jfeilbach / start.sh
Last active Nov 8, 2020
during migration put on cron job to start torrents added to transmission
View start.sh
#!/bin/bash
NC='\033[0m' # No color
Green='\033[0;32m' # Green
White='\033[0;37m' # White
Red='\033[0;31m' # Red
Yellow='\033[0;33m' # Yellow
counter='1'
cmd=/usr/bin/transmission-remote
@jfeilbach
jfeilbach / search.sh
Last active Nov 8, 2020
Search through <path>/*.torrent files for string $1. Passes two variables $(hash} and ${name} to rsync.sh script for migration.
View search.sh
#!/bin/bash
# Searches through directory of .torrent files for matchign string. If string found move to host, stop torrent, and add to new host.
# If you want to just move all .torrents then comment out "result" and uncomment the alternative version.
NC='\033[0m' # No color
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
Blue='\033[0;34m' # Blue
Purple='\033[0;35m' # Purple
@jfeilbach
jfeilbach / rsync.sh
Last active Nov 8, 2020
Move torrent from qbittorrent to Transmission read ${1} and ${2} from input
View rsync.sh
#!/bin/bash
NC='\033[0m' # No color
Green='\033[0;32m' # Green
White='\033[0;37m' # White
Red='\033[0;31m' # Red
dldir=/dl_1
mnt1=/mnt/picard_e/
mnt2=/mnt/picard_f/
mnt3=/mnt/picard_g/
@jfeilbach
jfeilbach / gist:f4a4b4991b178d154761e9ec7f1b085b
Last active Oct 5, 2020
get hdd temp and convert from C to F
View gist:f4a4b4991b178d154761e9ec7f1b085b
while true ; do
/bin/date
temp=$(smartctl -a /dev/sdf |grep 194 | awk '{ print $10}')
echo "scale=2;9*${temp}/5+32" | bc -l
echo ""
sleep 60
done
exit 0