Skip to content

Instantly share code, notes, and snippets.

alphabet = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'
base = len(alphabet)
def b58enc(div, s=''):
if div >= base:
div, mod = divmod(div, base)
return b58enc(div, alphabet[mod] + s)
return alphabet[div] + s
def b58dec(s):

Keybase proof

I hereby claim:

  • I am n8foo on github.
  • I am n8foo (https://keybase.io/n8foo) on keybase.
  • I have a public key whose fingerprint is 3855 194E 906B EA29 5F2E 030F CB01 D733 1ACF 1E3A

To claim this, I am signing this object:

@n8foo
n8foo / image_reload.js
Created June 27, 2014 00:57
javascript snippit to reload all the images on a page
setInterval(function() {
var images = document.images;
for (var i=0; i<images.length; i++) {
images[i].src = images[i].src.replace(/\btime=[^&]*/, 'time=' + new Date().getTime());
}
}, 10000); // 10000 milliseconds = 10 seconds
@n8foo
n8foo / setup.sh
Created August 10, 2014 03:57
RPI SDR Install Instructions
# Install dependencies
sudo apt-get update
sudo apt-get -y install git cmake build-essential libusb-1.0 qt4-qmake libpulse-dev libx11-dev
# Fetch and compile rtl-sdr source
mkdir -p ~/src/
cd ~/src/
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr
mkdir build
@n8foo
n8foo / openssl_shortcuts.sh
Created April 17, 2015 02:56
openssl shortcuts
# check date of certificate on remote site
echo | openssl s_client -connect ssl.example.com:443 | openssl x509 -noout -dates
#! /bin/bash
WD=`pwd`
DOMAIN=example.com
GITS=`find . -maxdepth 2 -name .git -type d | sed "s/\.\///g" | sed "s/\/.*//g"`
SVNS=`find . -maxdepth 2 -name .svn -type d | sed "s/\.\///g" | sed "s/\/.*//g"`
case $1 in
setup)
@n8foo
n8foo / amazon_ip_space.txt
Created February 15, 2012 16:16
Amazon EC2 IP Space
# US East (Northern Virginia):
72.44.32.0/19 (72.44.32.0 - 72.44.63.255)
67.202.0.0/18 (67.202.0.0 - 67.202.63.255)
75.101.128.0/17 (75.101.128.0 - 75.101.255.255)
174.129.0.0/16 (174.129.0.0 - 174.129.255.255)
204.236.192.0/18 (204.236.192.0 - 204.236.255.255)
184.73.0.0/16 (184.73.0.0 – 184.73.255.255)
184.72.128.0/17 (184.72.128.0 - 184.72.255.255)
184.72.64.0/18 (184.72.64.0 - 184.72.127.255)
50.16.0.0/15 (50.16.0.0 - 50.17.255.255)
@n8foo
n8foo / gist:1891362
Created February 23, 2012 07:43
bash example to redirect stdout to logfile
DATE=`date +%F`
case "$1" in
"-v")
echo "verbose enabled"
;;
"-h")
echo "(description)"
echo $"Usage: $0 (-v|-h)"
exit 1
@n8foo
n8foo / ssh_limit.sh
Created March 1, 2012 17:46
ssh limit with iptables
#! /bin/bash
# this iptables rules sets an ssh limit of 4 per 60 seconds
IPT=`which iptables`
$IPT -A ssh_limit -p tcp -m recent --set --name ssh --rsource
$IPT -A ssh_limit -p tcp -m recent ! --rcheck --seconds 60 --hitcount 4 --name ssh --rsource -j ACCEPT
$IPT -A ssh_limit -j LOG --log-level info --log-prefix "SSH_LIMIT: "
$IPT -A ssh_limit -j DROP
@n8foo
n8foo / filesystems.txt
Created March 15, 2012 16:44
Largest Filesystems
sdis1-1# df -kh
Filesystem Size Used Avail Capacity Mounted on
OneFS 27T 18T 8.7T 68% /ifs
sdis01-1# df -kh
Filesystem Size Used Avail Capacity Mounted on
OneFS 32T 23T 9.7T 70% /ifs