Skip to content

Instantly share code, notes, and snippets.

@hydrian
hydrian / plex-le-renew-deploy-script.sh
Last active March 21, 2025 14:53
Let's Encrypt Plex renew-hook script
#!/usr/bin/env -S bash
logger -p daemon.debug -- "Running $(realpath "$0")"
PLEX_BASE_DIR="${PLEX_BASE_NAME:-/var/lib/plexmediaserver}"
SERVICE_NAME="plexmediaserver.service"
PLEX_USER="${PLEX_USER:-plex}"
PLEX_GROUP="${PLEX_GROUP:-plex}"
function cleanup {
test -e "$TEMP_DIR" && rm -Rf "$TEMP_DIR"
return 0
@hydrian
hydrian / 01-pm-block-sleep-docker.sh
Last active April 17, 2023 16:25
Script to prevent sleep while docker specific containers is running
#!/usr/bin/env bash
##############
### Config ###
##############
DOCKER_CONTAINER_NAMES=(
"CONTAINER NAME"
"CONTAINER NAME2"
)
@hydrian
hydrian / disk_sudo.conf
Created April 17, 2020 13:44
disk_sudo definition
object CheckCommand "disk_sudo" {
import "plugin-check-command"
import "disk"
command = [ "/usr/bin/sudo", "/usr/lib/nagios/plugins/check_disk" ]
timeout = 1m
arguments += {
"-A" = {
description = "Explicitly select all paths. This is equivalent to -R .*"
set_if = "$disk_all$"
@hydrian
hydrian / ldap-nss-cache-refresh
Created January 6, 2020 01:21
Updated local NSS cache from LDAP
true
@hydrian
hydrian / normalize_cert.sh
Created June 19, 2019 15:28
Normalizes cert filename based on subject and puts full text and encoded data in contents
#!/bin/bash
ORIG_CERT_FILE="${1}"
if [ ! -e "${ORIG_CERT_FILE}" ] ; then
echo "${ORIG_CERT_FILE} filename does not exist" 1>&2
exit 2
fi
ORIG_CERT_DIR=$(dirname $(realpath "$ORIG_CERT_FILE"))
CERT_SUBJECT="$(openssl x509 -in "${ORIG_CERT_FILE}" -noout -subject)"
@hydrian
hydrian / keybase.md
Created November 14, 2017 17:34
Key Base Public Key

Keybase proof

I hereby claim:

  • I am hydrian on github.
  • I am hydrian (https://keybase.io/hydrian) on keybase.
  • I have a public key ASBzYWtzdmvYPxkJCv7B-Zlx_SCONXKVr2_G_aVhdTOd1Ao

To claim this, I am signing this object: