Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#Creates list of all domains to be checked
sites="example.com
other.exampl.ecom
"
DAYS=30
goodcerts=()
badcerts=()
@thundernode
thundernode / gogs-upgrade.sh
Created September 18, 2016 14:25
Upgrade gogs to latest release for amd64 linux
#!/bin/bash
appfolder="/home/thundernode/test/gogs"
archivefolder="/home/thundernode/test/archive-gogs"
remotever=`curl -s https://api.github.com/repos/gogits/gogs/releases/latest | grep 'tag_name' | sed 's/.*\"v\(.*\)\".*/\1/g'`
localver=`awk -F "." '{print $1 "." $2 "." $3}' $appfolder/templates/.VERSION`
upgrade() {
TMPFILE=`mktemp /tmp/gogs.XXXXXXXXXX` || { echo "failed to create temporary file"; exit 1; }
wget -O - https://dl.gogs.io/gogs_v${remotever}_linux_amd64.tar.gz > $TMPFILE || { echo "download failed"; exit 1; }
gzip -t $TMPFILE || { echo 'File corrupted'; exit 1; }
mkdir $archivefolder/$remotever || { echo "Error creating $archivefolder/$remotever"; exit 1; }
@thundernode
thundernode / sslcheck.sh
Created April 15, 2016 01:10
Script that warns of expiring certificate. good for cron and Let's Encrypt
#!/bin/bash
#Specify folder containing certificate folders
cert_folder='/etc/apache2/ssl'
#Default number of days if none specified
DAYS=30
#Check if specified certificate folder exists
if [ ! -e $cert_folder ]; then
echo "invalid cert folder"
exit 1
@thundernode
thundernode / keybase.md
Created June 27, 2015 02:34
keybase.io verification

Keybase proof

I hereby claim:

  • I am thundernode on github.
  • I am thundernode (https://keybase.io/thundernode) on keybase.
  • I have a public key whose fingerprint is BEB0 11FE 77BA 538D B87B 0A24 2DAC 449F 2616 B69D

To claim this, I am signing this object:

@thundernode
thundernode / nginx-logrotate
Created December 17, 2014 02:37
Rotating Nginx logs
#!/bin/bash
DATE=`date +%Y.%m.%d.%H:%M`
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root"
exit 1
fi
find /var/log/nginx/ -type f -name '*.log' -exec mv {} {}.$DATE \;
find /var/log/nginx/ -type f -name "*.log.$DATE" -exec gzip {} \;
@thundernode
thundernode / sslgen.sh
Last active May 13, 2016 19:43
Generate SSL Certificate
#!/bin/bash
today=`date +%Y.%m.%d`
selfexpire=1095
#Defaults
country="CHANGEME" #must be country code (two letters)
province="CHANGEME"
city="CHANGEME"
organ="CHANGEME"
#User prompts
read -e -p "Enter Your Country (two letter code) [${country}]: " incountry