Skip to content

Instantly share code, notes, and snippets.

View whiteley's full-sized avatar

Matt Whiteley whiteley

View GitHub Profile
@whiteley
whiteley / add-image-cloud-config.txt
Created November 3, 2012 03:17 — forked from smoser/add-image-cloud-config.txt
user-data script for easy usage of cloud-publish-ubuntu.
#!/bin/sh
#
# This is a user-data script that launches an instance, and then sets
# it up to be able to publish a daily or released build as easy as
# possible. use:
# euca-run-instances <some-ami> --user-data-file <this file> --key mykey
#
# Then, copy credentials to the instance and read 'README'
#
# gist: https://gist.github.com/1231973
@whiteley
whiteley / gist:4053040
Created November 10, 2012 23:59 — forked from grantr/gist:1105416
Chef mysql master/slave recipes
## mysql::master
ruby_block "store_mysql_master_status" do
block do
node.set[:mysql][:master] = true
m = Mysql.new("localhost", "root", node[:mysql][:server_root_password])
m.query("show master status") do |row|
row.each_hash do |h|
node.set[:mysql][:master_file] = h['File']
node.set[:mysql][:master_position] = h['Position']
end
#!/bin/bash
set -o errexit
set -o nounset
if [[ ${#} -ne 1 ]]
then
echo "Usage: ${0} upstart-conf-file" >&2
exit 1
fi
#!/usr/bin/env ruby
begin
require 'aws'
rescue LoadError => e
abort "Unable to load library: #{e.message}"
end
require 'Forwardable'
@whiteley
whiteley / gist:4328594
Created December 18, 2012 14:45
vmbuilder manifest bug
Traceback (most recent call last):
File "/usr/bin/vmbuilder", line 24, in <module>
cli.main()
File "/usr/lib/python2.7/dist-packages/VMBuilder/contrib/cli.py", line 216, in main
distro.build_chroot()
File "/usr/lib/python2.7/dist-packages/VMBuilder/distro.py", line 84, in build_chroot
self.call_hooks('configure_os')
File "/usr/lib/python2.7/dist-packages/VMBuilder/distro.py", line 67, in call_hooks
call_hooks(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/VMBuilder/util.py", line 165, in call_hooks
require "rubygems"
require "geminabox"
Geminabox.data = "/mnt/gems/data"
Geminabox.configure do |config|
config.set(:incremental_updates, true)
end
Geminabox.build_legacy = false
run Geminabox
@whiteley
whiteley / md.go
Last active September 1, 2016 04:43
Crawl EC2 meta-data and output JSON
package main
import "bytes"
import "bufio"
import "encoding/json"
import "flag"
import "fmt"
import "net/http"
import "os"
import "strings"
@whiteley
whiteley / gist:4953648
Created February 14, 2013 15:46
Please enter your Twitter password. Fancy.
havak:~$ curl -D - -L -v http://t.co/DlHFba3
* About to connect() to t.co port 80 (#0)
* Trying 199.59.150.44...
* connected
* Connected to t.co (199.59.150.44) port 80 (#0)
> GET /DlHFba3 HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: t.co
> Accept: */*
>
@whiteley
whiteley / create_mcf.sh
Last active December 13, 2015 18:18 — forked from drnic/create_mcf.sh
#!/usr/bin/env bash
set -e # exit immediately if a simple command exits with a non-zero status
set -u # report the usage of uninitialized variables
STEMCELLS_DIR=${STEMCELLS_DIR:-/var/vcap/store/stemcells}
RELEASES_DIR=${REPOS_DIR:-/var/vcap/store/releases}
REPOS_DIR=${REPOS_DIR:-/var/vcap/store/repos}
CF_RELEASE_BRANCH=${CF_RELEASE_BRANCH:-staging}
@whiteley
whiteley / notes.md
Created February 20, 2013 04:13
notes about notes