Skip to content

Instantly share code, notes, and snippets.

View drnic's full-sized avatar
🏆
Platinum Status Level

Dr Nic Williams drnic

🏆
Platinum Status Level
View GitHub Profile
#!/bin/bash
aws cloudformation create-stack --stack-name test-vpc --template-body file://vpc.json
@frodenas
frodenas / cf.yml
Created May 5, 2014 18:29
CloudFoundry (small) deployment manifest for Google Compute Engine
<%
director_uuid = 'CHANGEME'
static_ip = 'CHANGEME'
root_domain = "#{static_ip}.xip.io"
deployment_name = 'cf'
cf_release = '170'
protocol = 'http'
common_password = 'c1oudc0wc1oudc0w'
%>
---
@frodenas
frodenas / cf-170-openstack.yml
Last active August 29, 2015 14:01
Cloud Foundry v170 deployment manifest for OpenStack
<%
director_uuid = 'CHANGEME'
static_ip = 'CHANGEME'
root_domain = "#{static_ip}.xip.io"
deployment_name = 'cf'
cf_release = '170'
protocol = 'http'
common_password = 'c1oudc0wc1oudc0w'
%>
---
require 'psych'
def tree o, options = {}
visitor = Psych::Visitors::YAMLTree.create options
visitor << o
visitor.tree
end
# create a YAML AST from a Ruby object
my_object = [ "(( foo ))" ]
@selenamarie
selenamarie / a_better_opml.py
Last active December 11, 2015 09:59
This grabs URLs associated with the people you follow on Twitter and then tries to scrape RSS feeds from the URLs. You have to get OAUTH creds from dev.twitter.com/apps to do this, and then register the script so that you get the access_token + access_token_secret. Rev 2 actually produces valid OPML. ;)
#!/usr/bin/env python
import tweepy
from BeautifulSoup import BeautifulSoup as parser
import urllib
import sys
import argparse
import ConfigParser
@adamhjk
adamhjk / Guardfile
Last active December 17, 2015 03:19
A Guardfile with inline support for test-kitchen, before we turn it into a gem.
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
require 'guard/guard'
require 'mixlib/shellout'
module ::Guard
class Kitchen < ::Guard::Guard
def start
::Guard::UI.info("Guard::Kitchen is starting")
@rkoster
rkoster / migrate_blobs.sh
Last active December 18, 2015 01:39
Script for migrating blobs from one blob store to an other. This script expects a config/private.tmp.yml file which will be renamed to config/private.yml when blobs are downloaded. The contents for the new config/final.yml are hardcoded into the script. You should fill in your own target blobstore credentials
#!/bin/sh
# reset stuff
sudo rm -r .blobs
rm -r blobs
rm -r blobs_import
git checkout -- config/blobs.yml
git checkout -- config/final.yml
rm config/private.yml
@drnic
drnic / github_user_collaborations.rb
Created July 13, 2010 10:30
Discover the contribution status of a user for all their watched repos: owner, collaborator, or watcher
#!/usr/bin/env ruby
#
# Discover the contribution status of a user for all their watched repos: owner, collaborator, or watcher
# Returns either JSON (default) or HTML (example http://github-user-profiles-example.heroku.com/)
#
# JSON: Returns either Array of JSON; or streams each JSON result as discovered (--stream flag)
# { "repo" => { ... }, "owner" => is project owner?, "collaborator" => has collaborator access? }
#
# HTML: Sort-of pretty HTML output. Nice to use --stream | bcat.
#
@drnic
drnic / convert-to-credhub.sh
Last active December 20, 2017 11:09
Convert a ci/settings.yml with `(( vault "/secret/mything" ))` into concourse cred mgmt + a credhub import file
#!/bin/bash
cd ${1:?USAGE: convert-to-credhub.sh path/to/ci}
function indent() {
c='s/^/ /'
case $(uname) in
Darwin) sed -l "$c";;
*) sed -u "$c";;
esac
@dysinger
dysinger / easy-ubuntu-openvpn.sh
Created August 28, 2013 18:22
Create a VPN on EC2 in 30 seconds
#!/bin/sh
# linux firewall/forwarding
modprobe iptable_nat
echo 1 | tee /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 10.10.10.1/2 -o eth0 -j MASQUERADE
# install openvpn
apt-get update && apt-get install -y openvpn
cd /etc/openvpn/
INSTANCE=$(curl http://169.254.169.254/latest/meta-data/public-hostname)
openvpn --genkey --secret ${INSTANCE}.key