Instantly share code, notes, and snippets.

View Very Gisty
export COLOR_NC='\e[0m' # No Color
export COLOR_WHITE='\e[1;37m'
export COLOR_BLACK='\e[0;30m'
export COLOR_BLUE='\e[0;34m'
export COLOR_LIGHT_BLUE='\e[1;34m'
export COLOR_GREEN='\e[0;32m'
export COLOR_LIGHT_GREEN='\e[1;32m'
export COLOR_CYAN='\e[0;36m'
export COLOR_LIGHT_CYAN='\e[1;36m'
export COLOR_RED='\e[0;31m'
View example-result.txt
["192.168.101.4", "174.128.50.29", "192.168.101.3", "192.168.100.12", "174.128.50.28", "192.168.100.16", "10.0.28.20", "192.168.100.15", "174.128.50.5", "10.0.255.52", "10.0.28.14", "192.168.100.13", "10.0.28.15", "192.168.100.10", "174.128.50.9", "10.0.28.16", "10.0.28.13", "10.0.28.12", "192.168.100.11", "10.0.28.11", "10.0.28.7", "192.168.100.9", "10.0.28.6", "192.168.100.8", "192.168.100.6", "174.128.50.17", "10.0.28.5"]
View fog.md

Given a router, get the attached external gateway's pool name:

floating_ip_pool_name = network.networks.get(router.external_gateway_info["network_id"]).name
# => "IO.IP"

Use the pool name to provision a floating IP:

View rebuild.sh
#!/usr/bin/env bash
set -x
set -e
export CF_VERSION=v154
export CF_RELEASE_DIR=${CF_RELEASE_DIR:-"$HOME/Projects/bosh_releases/cf-release"}
export TEST_APP_DIR=${TEST_APP_DIR:-"$HOME/Sites/cloudfoundry_apps/service-binding-proxy"}
export BROKER_DIR=${BROKER_DIR:-"$HOME/Sites/servaas"}
View Dockerfile
FROM stackbrew/ubuntu:saucy
MAINTAINER Dr Nic Williams
# reduce output from debconf
ENV DEBIAN_FRONTEND noninteractive
# 'apt-get update' always return 0. we should check actually updated.
RUN apt-get update | tee /tmp/apt-update_output
RUN ! (grep '^Err' /tmp/apt-update_output)
View preparation.md

Run docker server on a fresh folder:

docker -d -g /home/core/docker-build/ -p /var/run/docker-build.pid -H tcp://127.0.0.1:5011

In the gnatsd-dockerfile project:

docker -H localhost:5011 build -t localhost:5011/gnatsd .
View gist:8927193
Pulling ubuntu image from public registry
```
core@localhost ~ $ docker -H tcp://localhost:5011 pull ubuntu:13.04
Pulling repository ubuntu
eb601b8965b8: Download complete
511136ea3c5a: Download complete
f323cf34fd77: Download complete
core@localhost ~ $ docker -H tcp://localhost:5011 images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
View private-docker-play.md

Running local fresh docker in a terminal:

mkdir -p /home/core/docker1
sudo docker -d -g /home/core/docker1 -p /var/run/docker1.pid -H tcp://127.0.0.1:5011

Pulling ubuntu image from public registry into that docker (in another terminal):

View skydock.log
$ docker logs -f skydock
[info] 1392353435 skydock: loading plugins from /plugins/default.js
[debug] 1392353435 skydock: starting restore of containers
[info] 1392353435 skydock: adding 10d3ea0995 (skydns) to skydns
[debug] 1392353435 skydock: starting main process
[debug] 1392353435 skydock: received event (start) 0f231d44eb6271ab82976ba1829dcb53483b8983e20c88c3f410408ff0060a9b crosbymichael/skydock:latest
[info] 1392353435 skydock: adding 0f231d44eb (skydock) to skydns
[debug] 1392353582 skydock: received event (die) 10d3ea09958ab0771cb12ed36131a4d35099e00127ac05c88de4dd3aebc78e53 crosbymichael/skydns:latest
[info] 1392353582 skydock: removing 10d3ea0995 from skydns
[debug] 1392353582 skydock: received event (stop) 10d3ea09958ab0771cb12ed36131a4d35099e00127ac05c88de4dd3aebc78e53 crosbymichael/skydns:latest
View snippets.md

Find a RouteTable for a given public Subnet:

subnet = Fog::Compute["aws"].subnets.last
subnet_id = subnet.subnet_id

rts = Fog::Compute["aws"].route_tables
route_table_for_subnet = rts.find {|rt| rt.associations.find {|assoc| assoc["subnetId"] == subnet_id} }