Skip to content

Instantly share code, notes, and snippets.

View rcguy's full-sized avatar

rcguy

  • 127.0.0.1
View GitHub Profile
@rcguy
rcguy / rtorrent_copy_torrents.py
Created January 12, 2022 22:59
Copy torrent metafile to folder matching label from rTorrent using XML-RPC
#!/usr/bin/env python3
"""
rtorrent_copy_torrents.py
v2021-01-12
Copy torrent metafile to folder matching label from rTorrent using XML-RPC.
This script probably does not do what you want, its for a very specific use-case.
Only works when the torrent label matches the root folder the torrent is saved in.
@rcguy
rcguy / rtorrent_delete_unregistered.py
Last active January 12, 2022 22:46
Remove and delete unregistered torrents from rTorrent using XML-RPC
#!/usr/bin/env python3
#
# rtorrent_delete_unregistered.py - Remove and delete unregistered torrents from rTorrent using XML-RPC
# v2021-01-12
#
# import required modules
import xmlrpc.client, re, os, shutil, logging
#!/bin/bash
# Installs deluge daemon + webui and systemd start scripts
# Tested on: Ubuntu Server 16.04.1 x64 / 4 Cores / 4GB RAM / 20 GB SSD
USER="rcguy"
# update the system first
sudo apt update && sudo apt upgrade -y
# add the deluge ppa so we get the most recent version
sudo add-apt-repository ppa:deluge-team/ppa
@rcguy
rcguy / vnstati.html
Created August 14, 2018 03:41
A simple webpage to show vnStati images
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>vnStati</title>
<link rel="shortcut icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAM1BMVEUAAAAABTMAAzMAADMAAzMAAzMAADEABTIAAzQAAzMAADMAAzMAADcAADAAACQAAzMAAAD4qojgAAAAD3RSTlMAN7kP8MgqOGPnGeAcIAcMvjsxAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAAN1wAADdcBQiibeAAAAAd0SU1FB+IIDgUPHjyrz5wAAADASURBVFjD7dbZCsQgDIVhu9pt2vd/2ynacbokkJxAr5LLwP8hiGAIxFR1EyxTtVtnEfZ+swipNwhHDwulB4VTDwmXHhBuvVp49EqB6FUC2SsEphcLbC8V+vibIWdjWcRJdRUhZmDWVQ44IAKWT5oVBua8jQ444MB7wJof7gID9DjgAA5M/2/OmIGhLHoJ0HTsz6utREdgBWHPCuKeERQ9Kah6QlD2D0Hd3wSgvwhQfxLAvghwfwiGPgmmfhdqsv8CjMksPRWDjloAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtMDgtMTRUMDU6MTU6MzArMDI6MDCHAotxAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTA4LTE0VDA1OjE1OjMwKzAyOjAw9l8zzQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAAASUVORK
[Unit]
Description=rTorrent Daemon
After=network.target
[Service]
Type=forking
KillMode=none
User=username
Group=username
ExecStartPre=-/bin/rm -f /home/username/.rtorrent/session/rtorrent.lock
# Stop dance for nginx
# =======================
#
# ExecStop sends SIGSTOP (graceful stop) to the nginx process.
# If, after 5s (--retry QUIT/5) nginx is still running, systemd takes control
# and sends SIGTERM (fast shutdown) to the main process.
# After another 5s (TimeoutStopSec=5), and if nginx is alive, systemd sends
# SIGKILL to all the remaining processes in the process group (KillMode=mixed).
#
# nginx signals reference doc:
[Unit]
Description=irssi daemon
After=network.target
[Service]
Type=forking
User=%i
ExecStart=/usr/bin/screen -dmS autodl irssi
ExecStop=/usr/bin/screen -S autodl -X stuff '/quit\n'
WorkingDirectory=%h
#!/bin/bash
# Dependencies
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
# vars
OPENSSL_VER="1.1.0c"
NGINX_VER="1.11.8"
@rcguy
rcguy / rtorrent.sh
Last active August 14, 2018 03:43
a simple bash script to compile and build .deb packages for xmlrpc-c, libtorrent, and rtorrent
#!/bin/bash
# ==> VARIABLES <==
# Software Versions
LIBTORRENT_VER="0.13.6"
RTORRENT_VER="0.9.6"
XMLRPC_VER="1.39.12"
PKG_RELEASE="3"
PREFIX="/usr"
@rcguy
rcguy / nginx.sh
Last active January 13, 2017 08:12
#!/bin/bash
# Dependencies
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
# vars
OPENSSL_VER="1.1.0c"
NGINX_VER="1.11.8"