Skip to content

Instantly share code, notes, and snippets.

View jeremyvisser's full-sized avatar

Jeremy Visser jeremyvisser

View GitHub Profile
@jeremyvisser
jeremyvisser / node-to-acl
Created September 22, 2012 05:58
Internode to Cisco ACL
#!/usr/bin/env python
# usage:
#
# wget https://customer-webtools-api.internode.on.net/unmetered_ip_address_list.txt
# ./node-to-acl < unmetered_ip_address_list.txt
import sys
import ipaddr
try:
@jeremyvisser
jeremyvisser / pydb.py
Created December 22, 2012 13:59 — forked from anonymous/pydb.py
#!/usr/bin/env python
import cgi
import cgitb
import mysql.connector
DB_HOST = 'localhost'
DB_DATABASE = ''
DB_USER = ''
DB_PASS = ''
""" VT100 control code wrappers
Example usage:
import vt100
print vt100.blue('the sky').red(' is red').reset()
"""
RESET_TERMINAL = '\033c'
@jeremyvisser
jeremyvisser / speedtest.cron
Created March 18, 2013 03:50
Simple speed logging used for graphing variation. Log output is tab-delimited, which is very easy to put into a spreadsheet and turn into a graph. Logrotate is used to e-mail results daily.
# file: /etc/cron.d/speedtest
* * * * * root /usr/local/bin/speedtest 2>/dev/null >>/var/log/speedtest.log
#!/usr/bin/env python3
import sys
import time
import requests
from urllib.parse import urljoin
class HLSPipe:
""" HLSPipe — HTTP Live Streaming Pipe
@jeremyvisser
jeremyvisser / migrate-4-to-7.py
Last active December 31, 2015 14:29
Naïve migration of Atmail 4 to Atmail 7.1.
#!/usr/bin/env python
""" Atmail 4 to Atmail 7.1 migration
Copyright (C) 2013 Ace Internet Services Pty Ltd
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
#!/bin/bash
set -e -x
export LC_ALL=C
sudo apt-get update
sudo apt-get -y install devscripts git dpatch
git clone git://github.com/dotwaffle/rancid-git
### Keybase proof
I hereby claim:
* I am jeremyvisser on github.
* I am jeremyvisser (https://keybase.io/jeremyvisser) on keybase.
* I have a public key whose fingerprint is CFF4 E176 D294 DAED F603 3FE2 360F 8D38 A532 6F5B
To claim this, I am signing this object:
@jeremyvisser
jeremyvisser / bellos.py
Created May 30, 2015 07:26
Alex Bellos' method of winning a guessing game
#!/usr/bin/env python3
""" Test Alex Bellos' method of winning a guessing game.
Take two random numbers, a and b. The objective is to
guess whether a is greater than or less than b.
You might think you have a 50% chance of guessing correctly,
which is true if guessed randomly.
@jeremyvisser
jeremyvisser / custom.sh
Last active March 12, 2016 11:46
SCLUG Installfest 2015
#!/bin/bash
set -e -x
# required for dpkg to work
export PATH=/usr/bin:/usr/sbin:/bin:/sbin
cat >/etc/apt/sources.list <<EOF
deb http://ap-southeast-2.archive.ubuntu.com/ubuntu/ trusty main restricted multiverse universe
deb http://ap-southeast-2.archive.ubuntu.com/ubuntu/ trusty-updates main restricted multiverse universe