Skip to content

Instantly share code, notes, and snippets.

View rambotech's full-sized avatar

John J Schultz rambotech

View GitHub Profile
@rambotech
rambotech / gist:0c942d9b0b8e24c6653c10a844a1b376
Created January 30, 2025 20:56
Script for launching certbot renew, but opening and closing port 80 only for the duration of the refresh.
#!/bin/bash
echo ===============
echo Open port 80 for verification ...
echo ===============
you cufw allow 80/tcp && ufw reload
echo
echo ==============
echo Certififcate refresh / renew
@rambotech
rambotech / NVRAM_make_restore.sh
Created July 7, 2020 14:31
Backup DD-WRT NVRAM settings to a shell script for easy restore.
# make a full restore shell script for the current nvram settings
FILE=$HOSTNAME-restore-sh
nvram show | grep = | grep -v -e =$ | awk -F'=' '{print $1}' | sort -f | (IFS=''; while read VAR; do VAL=$(nvram get ${VAR}); [ -n "$VAL" ] && printf 'nvram set %s='\''%s'\''\n' ${VAR} ${VAL/\'/\'\\\'\'}; done) > $FILE
nvram save >> $FILE
nvram commit >> $FILE
# insert an scp statement, etc, to copy the content to a storage location.