Skip to content

Instantly share code, notes, and snippets.

View njregenwether's full-sized avatar

Nolan njregenwether

View GitHub Profile
@njregenwether
njregenwether / rokuoff.py
Last active December 30, 2019 07:02
Turn Roku Off
#!/usr/bin/python
# Simple script to turn off roku. Send it an ip address of your roku and it'll turn it off.
# This script is so green and earth friendly it basically refrigerates the polar ice caps.
# Schedule this with cron to turn your roku and most likely TV off.
#
# crontab -e
# ex. shut off my roku at 8 am every day if roku is on 192.168.1.2
# 0 8 * * * ./rokuoff.py 192.168.1.2
@njregenwether
njregenwether / Making a network change without losing access
Created June 15, 2019 20:11
Very simple procedure for testing a network change without losing access to the server.
If you are considering making a network change and don't want to risk a down machine that you would then have to console into... here's what to do.
1. Copy your working network configuration
cp /etc/network/interfaces /etc/network/interfaces.working.bak
2. Make your changes to the network connection
cat /etc/network/interfaces.withchanges > /etc/network/interfaces
3. Create a script to undo the change
vi /root/reset_net.sh
#!/bin/bash
# run this as root
# This is basically stolen from digital ocean's guide, just made to be a bit more automated.
# This will install and configure fail2ban for a centos7 system using firewalld.
# No iptables were injured in the making of this gist.
# Install fail2ban.
yum -y install epel-release
@njregenwether
njregenwether / ManuallyScanPlexLibrary.sh
Last active January 14, 2026 05:36
Manually Scan Plex Library
#!/bin/bash
##########################################################################################################################
# This will update plex libraries manually from the command line. #
# This will work on centos 7 but I can't make any guarantees about other OSes or platforms. #
# If you're running plex on mac os x or windows, get a real OS. #
# #
# The exports below are important because if you don't have all of them set, you will get no result when you go to list #
# ./Plex\ Media\ Scanner --list #
# This will show you all of your libraries and their numbers. #
#!/bin/bash
##########################################################################################################################
# This is a template for a script that only runs when it's not already running. The first thing this will do is to check #
# to make sure that it is not running. #
# #
# Then this script will check to see if the latest file it has processed is its 'touched' file which is compares the MAC #
# times to ensure it only runs if there is work to be done. #
# #
# The idea is that you should schedule this in a cron job. Here is my example of how I scheduled my script. #