Skip to content

Instantly share code, notes, and snippets.

@jeremysherriff
jeremysherriff / viomi_error_translation.sh
Created July 22, 2022 05:03
Viomi styj02ym vacuum err_state mapping
#!/bin/bash
if [[ -z $1 ]]; then
errcode="0"
else
errcode=$1
fi;
# use case statement to make decision for errcode
case $errcode in
@jeremysherriff
jeremysherriff / watchtower.sh
Created June 8, 2022 06:31
Automated updating of containers via cron
#!/bin/sh
# Automated updating of containers via cron
# Leverages watchtower for auto image cleanup and robustness.
if [ -t 1 ] ; then
echo "Running in an interactive shell"
else
exec 1>/dev/null
exec 2>/dev/null
#!/bin/bash
# Credit for original script:
# https://pubs.vmware.com/vsphere-6-5/topic/com.vmware.vsphere.vcsapg-rest.doc/GUID-222400F3-678E-4028-874F-1F83036D2E85.html
# Enhanced to add error checking, status display etc - Jeremy Sherriff 2018
# Depends on jq (jq-linux64) from https://stedolan.github.io/jq
# TO-DO: Move to PowerCli/Powershell version.
# See https://blogs.vmware.com/PowerCLI/2018/07/automate-file-based-backup-of-vcsa.html
# References:
# https://support.plex.tv/articles/201638786-plex-media-server-url-commands/
# https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
# Sections
# 1 = Movies
# 2 = TV
# 4 = Home Movies
# Linux:
@jeremysherriff
jeremysherriff / 21-my-nic.rules
Created August 15, 2018 07:27
Sophos UTM NIC fix - create /etc/udev/rules.d/21-my-nic.rules
# https://community.sophos.com/products/unified-threat-management/astaroorg/f/utm-9-3-beta/65895/9-302-2-bug-adapter-e1000e-hangs-reset
#ethtool -K eth0 gso off <- Can't automate this!
#ethtool -K eth0 gro off
#ethtool -K eth0 tso off
SUBSYSTEM=="net", ACTION=="add", ATTRS{vendor}=="0x8086", ATTRS{device}=="0x1502", RUN+="/lib/udev/nic-disable-tso"
SUBSYSTEM=="net", ACTION=="add", ATTRS{vendor}=="0x8086", ATTRS{device}=="0x1502", RUN+="/lib/udev/nic-disable-gro"
@jeremysherriff
jeremysherriff / update_jackett.sh
Last active January 5, 2019 21:31
Update Jackett on Ubuntu nicely as it appears to bomb when auto-updating
#!/bin/bash
THISUSER=$(whoami)
if [ $THISUSER != 'root' ]
then
echo 'You must use sudo to run this script, sorry!'
exit 1
fi
echo "Jackett:"
echo "Grabbing current running state.."
@jeremysherriff
jeremysherriff / check_le_certs.sh
Last active October 21, 2018 03:16
BASH script to check nearing expiry of SSL certs and send email notification
#!/bin/bash
# Get ssl-cert-check from https://github.com/Matty9191/ssl-cert-check
# Check that the below script lines use the right cert locations
# and email parameters
RENEWAL_DAYS=14
TMPFILE=`mktemp -t email.XXXXXXXXXX`
ISEXPIRING=false
for CERT in $(ls -1R /etc/letsencrypt/live/*/cert.pem)
import requests
import json
ssl = False
ip = "192.168.0.32"
port = "3579"
usernm = "foo"
passwd = "bar"
WEBURL = "http" + ("s" if ssl else "") + "://"+ip+":"+port