Skip to content

Instantly share code, notes, and snippets.

View fud's full-sized avatar

Brenton Bills fud

  • Paypa Plane
  • Brisbane, Australia.
  • 15:02 (UTC +10:00)
View GitHub Profile
@fud
fud / iptables.txt
Created August 2, 2016 23:25
docker iptables
ubuntu@dm1a:/etc/network/interfaces.d$ sudo iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DOCKER all -- anywhere anywhere ADDRTYPE match dst-type LOCAL
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
@fud
fud / subnets.txt
Created August 4, 2016 01:25
Subnets using jq.
#echo $subnets | jq '.Subnets | .[] | .AvailabilityZone + ":" + (.Tags[]|select(.Key=="Name")|.Value |tostring) + ":" + .SubnetId'
#echo $subnets | jq -r '.Subnets | .[] | "[\"" + .AvailabilityZone + "\"]=" + .SubnetId'
@fud
fud / replace.sed
Created August 8, 2016 01:00
replace spaces with sed
billsb@Brentons-MacBook-Pro ~ $ more brent.js
function test():
this;
is;
a test;
billsb@Brentons-MacBook-Pro ~ $ sed 's/[[:space:]]\{4,\}/ /g' brent.js
function test():
this;
is;
a test;
@fud
fud / .zpreztorc
Last active August 13, 2016 03:14
Prezto themes with emacs.
#
# Prompt
#
# Set the prompt theme to load.
# Setting it to 'random' loads a random theme.
# Auto set to 'off' on dumb terminals.
if [[ $TERM =~ '^eterm' ]]; then
zstyle ':prezto:module:prompt' theme 'steeef'
@fud
fud / ag.sh
Last active August 24, 2016 09:16
Using the silver searcher to search for a string ignoring a subdirectory directory in a globbed set of directories.
ag --ignore-dir node_modules setState react-udemy-*
@fud
fud / gist:c9c6633bf0c488b6b3e8d9f5a0aa758b
Created September 1, 2016 04:01
Open ports on a mac.
billsb@Brentons-MacBook-Pro ~/work/finda-db (fixing-up-doc)$ "/System/Library/CoreServices/Applications/Network Utility.app/Contents/Resources/stroke" 192.168.99.100 1 10000
Port Scanning host: 192.168.99.100
Open TCP Port: 22 ssh
Open TCP Port: 2376
Open TCP Port: 5432 postgresql
@fud
fud / allocate.sh
Created September 3, 2016 08:06
More swap space for a docker machine.
for i in $(docker-machine ls | awk '{print $1}'); do
docker-machine ssh $i -- ls /swapfile || docker-machine ssh $i "fallocate -l 512M /swapfile && chmod 400 /swapfile && mkswap /swapfile" &&
docker-machine ssh $i "swapon /swapfile && echo '/swapfile none swap defaults 0 0' >> /etc/fstab" &>/dev/null;
done
@fud
fud / shell.arguments.sh
Created September 20, 2016 05:15
Shell command line arguments.
#!/usr/bin/env bash
prog=$(basename ${0})
# Defaults
verbose=0
env="staging"
function help() {
printf "Usage: %s [-h/--help] [-e/--env <env>] <url>\n" "$prog"
@fud
fud / shell.sh
Created October 31, 2016 03:55
Export automatically all the variables defined into a file
(api)~/api/code vagrant@bbills-vm » set -a ± SCRUM-8841:ce4e7d1
(api)~/api/code vagrant@bbills-vm » source /etc/finda/config.env ± SCRUM-8841:ce4e7d1
(api)~/api/code vagrant@bbills-vm » set +a
@fud
fud / files.sh
Created March 8, 2017 00:12
Run jshint on files modified in a branch.
git diff --name-only master | xargs jshint