Skip to content

Instantly share code, notes, and snippets.

View clayrichardson's full-sized avatar

clay richardson clayrichardson

View GitHub Profile
@clayrichardson
clayrichardson / hack.sh
Created March 31, 2012 21:33 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@clayrichardson
clayrichardson / rs_tag_json.py
Created March 22, 2012 19:23
rs_tag --list output into json
import sys, subprocess, json, re
import pprint
def get_local_tags():
# rs_tag_list_command = 'rs_tag --list | awk \'{print "\\""$2"\\","}\'' terrible
rs_tag_list_command = 'rs_tag --list | awk \'{print $2}\''
p = subprocess.Popen(rs_tag_list_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
output, errors = p.communicate()
return output.split()
@clayrichardson
clayrichardson / rs_tags.py
Created March 21, 2012 22:21
Grab info from rs_tag
import json, commands, re
import pprint
machines = json.loads(commands.getstatusoutput('rs_tag -q "ip:internal"')[1])
internal_addresses = []
external_addresses = []
host_string = ''
for machine,tags in machines.items():
@clayrichardson
clayrichardson / create_cluster.py
Created March 21, 2012 20:55
Create and tag Cassandra cluster on RightScale
import sys, urllib, httplib2, base64, json, re, time, paramiko
from operator import itemgetter
import pprint
headers = {}
cookie = ''
url_tail = '?api_version=1.0&format=js'
def create_url(method=None):
base_url = 'https://my.rightscale.com/api/acct/%s/' % account_id