Skip to content

Instantly share code, notes, and snippets.

# /etc/netplan/00-installer-config.yaml
## Comment out everything in here so that eth0 isn't configured
## Trap for young players - this generates a systemd network config in /run which overrides the one in /etc that you created above and it will take you hours to work that out
# This is the network config written by 'subiquity'
#network:
# ethernets:
# eth0:
# dhcp4: true
# dhcp6: true
@johnf
johnf / Telstra traceroute
Created May 14, 2018 08:34
Telstra and HE.NET routing
# https://www.telstra.net/cgi-bin/trace
1 gigabitethernet3-3.exi1.melbourne.telstra.net (203.50.77.49) 0.350 ms 0.284 ms 0.244 ms
2 bundle-ether3-100.exi-core10.melbourne.telstra.net (203.50.80.1) 1.618 ms 1.424 ms 2.244 ms
3 bundle-ether12.chw-core10.sydney.telstra.net (203.50.11.124) 13.989 ms 14.167 ms 15.237 ms
4 bundle-ether1.oxf-gw11.sydney.telstra.net (203.50.6.93) 14.864 ms 14.416 ms 14.988 ms
5 bundle-ether1.sydo-core03.sydney.reach.com (203.50.13.98) 15.610 ms 14.542 ms 14.861 ms
6 unknown.telstraglobal.net (202.84.247.45) 200.516 ms 201.549 ms 202.132 ms
7 i-0-5-0-22.paix02.bi.telstraglobal.net (202.84.247.41) 200.123 ms 200.183 ms 200.629 ms
8 he-peer.paix02.pr.telstraglobal.net (134.159.61.22) 199.884 ms 199.689 ms 199.748 ms
9 10ge4-1.core1.sjc1.he.net (72.52.92.114) 207.246 ms 201.521 ms 200.250 ms
@johnf
johnf / foo.sh
Created November 2, 2017 04:09
Remove merged branchs
function rmb {
current_branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ "$current_branch" != "master" ]; then
echo "WARNING: You are on branch $current_branch, NOT master."
fi
echo "Fetching merged branches..."
@johnf
johnf / download.sh
Created December 24, 2015 00:56
Extract Apple Firmware
#!/bin/bash
set -e
orig_dir=$(pwd)
dir=`mktemp -d` && cd $dir
# Grab Partial Zip
git clone git@github.com:planetbeing/partial-zip.git
set -ex
# Classic ruby deps
sudo DEBIAN_FRONTEND=noninteractive apt-get --option Dpkg::Options::='--force-confnew' --quiet --force-yes --yes install build-essential libxslt1-dev libxml2-dev zlib1g-dev
# We use brightbox ppa to get ruby 2.2
sudo apt-add-repository --yes ppa:brightbox/ruby-ng
sudo apt-get --quiet --yes update
sudo DEBIAN_FRONTEND=noninteractive apt-get --option Dpkg::Options::='--force-confnew' --quiet --force-yes --yes install ruby2.2 ruby2.2-dev
@johnf
johnf / apple.com
Created May 23, 2015 07:19
Telstra Cable Packet Loss
Start: Sat May 23 17:06:51 2015
HOST: kermit Loss% Snt Last Avg Best Wrst StDev
1.|-- router 0.0% 20 19.3 11.3 0.5 53.5 16.9
2.|-- 10.209.0.1 0.0% 20 14.6 25.8 6.6 110.8 30.1
3.|-- 58.160.15.8 0.0% 20 18.9 18.0 7.4 50.4 15.2
4.|-- 58.160.15.238 0.0% 20 17.8 21.7 8.3 76.6 20.5
5.|-- bundle-ether4.chw-edge902.sydney.telstra.net 0.0% 20 14.7 21.9 7.2 114.9 25.9
6.|-- bundle-ether14.chw-core10.sydney.telstra.net 0.0% 20 9.1 19.6 8.3 73.6 17.7
7.|-- bundle-ether17.oxf-gw2.sydney.telstra.net 0.0% 20 10.2 23.2 8.9 75.0 18.8
8.|-- bundle-ether1.sydo-core01.sydney.reach.com 0.0% 20 9.0 22.6 9.0 80.7 18.4
#!/usr/bin/env bash
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=10000
HISTFILESIZE=100000
HISTTIMEFORMAT='%F %T: '
PROMPT_DIRTRIM=3
# Default editor
export EDITOR="vim"
# Perform charset encoding detection as per http://tools.ietf.org/html/draft-abarth-mime-sniff-05
encoding = 'UTF-8'
if c.header_str =~ /Content-Type: (.*?)$/m
content_type = $1
if content_type =~/ISO-8859-1/i
encoding = 'ISO-8859-1'
elsif content_type =~ /UTF-8/i
encoding = 'UTF-8'
elsif content_type =~ /application\/vnd\.google\.gdata\.error\+xml/

Keybase proof

I hereby claim:

  • I am johnf on github.
  • I am johnf (https://keybase.io/johnf) on keybase.
  • I have a public key whose fingerprint is A946 8EB3 45CB 92B7 670D BAD0 4FFB 060C 9EC7 0B95

To claim this, I am signing this object:

@johnf
johnf / gist:7228007
Created October 30, 2013 06:31
Simple jabber server
// Based on code at https://github.com/astro/node-xmpp/blob/master/examples/c2s.js
var xmpp = require('node-xmpp');
var c2s = new xmpp.C2SServer({
port: 5222,
domain: 'localhost'
});
var sessions = {};