Skip to content

Instantly share code, notes, and snippets.

View tbaschak's full-sized avatar

Theo Baschak tbaschak

View GitHub Profile

Keybase proof

I hereby claim:

  • I am tbaschak on github.
  • I am tbaschak (https://keybase.io/tbaschak) on keybase.
  • I have a public key whose fingerprint is 8BB1 79F2 7ABB 1AFC F711 9E2A 2A0E 8675 EF4D 4F80

To claim this, I am signing this object:

@tbaschak
tbaschak / check-couch.sh
Created November 8, 2015 21:12
a script to check that couchdb is running (from cron) and restart it if its died. It logs to /root/couchdb-restart.log so you can verify when couchdb got restarted
#!/bin/bash
ps auxw | grep couchdb | grep -v grep > /dev/null
if [ $? != 0 ]
then
DATE=`date`
/etc/init.d/couchdb start > /dev/null
echo "$DATE restarted couchdb" >> /root/couchdb-restart.log
fi
#!/usr/bin/env python
from netaddr import *
cidr = IPSet(['192.168.0.0/24'])
used = IPSet(['192.168.0.1','192.168.0.8/29','192.168.0.64/26'])
cidr ^ used
#IPSet(['192.168.0.0/32', '192.168.0.2/31', '192.168.0.4/30', '192.168.0.16/28', '192.168.0.32/27', '192.168.0.128/25'])
@tbaschak
tbaschak / blockfinder-ca-asns.bash
Last active August 29, 2015 14:08
A script to run blockfinder (patched to run in cron without requiring a TTY), and then report the daily differences via email to the user running the script.
#!/bin/bash
TODAY=`date "+%Y-%m-%d"`
case $OSTYPE in
darwin*) YESTERDAY=`date -v -1d "+%Y-%m-%d"` ;;
linux*) YESTERDAY=`date --date="yesterday" "+%Y-%m-%d"` ;;
*bsd*) YESTERDAY=`date -v -1d "+%Y-%m-%d"` ;;
*) echo "unknown: $OSTYPE" ;;
esac
fail2ban:
pkg:
- installed
service:
- running
- require:
- pkg: fail2ban
- watch:
- file: /etc/fail2ban/jail.local
#!/bin/bash
function usage ()
{
echo "Usage:";echo " $0 <url>"
}
if [ $# -ne 1 ]; then
usage;exit 127
fi
@tbaschak
tbaschak / fingerprints.txt
Last active August 15, 2016 06:18
PGP fingerprints
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
I may periodically update this with additional fingerprints.
PGP Keys:
pub 4096R/0x2A0E8675EF4D4F80 2016-04-24 [expires: 2017-04-24]
Key fingerprint = 8BB1 79F2 7ABB 1AFC F711 9E2A 2A0E 8675 EF4D 4F80
uid [ultimate] Theodore Baschak <theodore@ciscodude.net>
16 54.214.242.0/24
15 54.197.251.0/24
15 46.229.169.0/24
15 162.243.226.0/24
14 162.243.142.0/24
13 37.187.9.0/24
12 146.185.179.0/24
10 95.85.61.0/24
10 54.84.236.0/24
10 54.213.177.0/24
@tbaschak
tbaschak / create_mysql_user.sh
Created June 21, 2014 21:50
create a mysql user and database, and give all privileges
mysqladmin -uroot -p create DBNAME
mysql -uroot -p -e "GRANT ALL PRIVILEGES ON DBNAME.* To 'USER'@'localhost' IDENTIFIED BY 'PASSWORD';"
#!/bin/bash
function usage ()
{
echo "Usage:"
echo " $0 <IP6 | hostname>"
echo "OR"
echo " $0 <IP6 | hostname> | tee mylog.txt"
}