Skip to content

Instantly share code, notes, and snippets.

View dkavanagh's full-sized avatar

David Kavanagh dkavanagh

View GitHub Profile
@dkavanagh
dkavanagh / update_catalog.py
Created September 17, 2012 17:51
Tool for updating eustore catalog based on signature calculated from tarballs
#!/usr/bin/env python
import os
import sys
import urllib2
import json
import hashlib
import zlib
from optparse import OptionParser
@dkavanagh
dkavanagh / LifeInColor.pde
Created December 9, 2012 04:12
Conway's Game Of Life running on an Arduino, displaying on a string of RGB LEDs arranged in a matrix
/*
* Conway's "Life"
*
* Adapted from the Life example
* on the Processing.org site
*
* Written by David Kavanagh (dkavanagh@gmail.com).
*/
#include "SPI.h"
#include "Adafruit_WS2801.h"
@dkavanagh
dkavanagh / create_users.sh
Last active June 7, 2016 12:46
This script creates test users that are the same as created by eucalyptus ui tests. So, if you're setting up a test cloud by some other means (like kickstarting a package-built cloud), you can run this after getting the admin credentials.
echo "{ \"Statement\": [ { \"Effect\": \"Allow\", \"Action\": \"*\", \"Resource\": \"*\" } ] }" >all.policy
k=0
ADMIN=`cat .euca/euca-admin.ini |grep "^user" |awk '{ print $3; }'`
HOST=`cat .euca/euca-admin.ini |grep "^default-region" |awk '{ print $3; }'`
REGION=$ADMIN@$HOST
for i in ui-test-acct-00 ui-test-acct-01 ui-test-acct-02 ui-test-acct-03
do
echo "creating users for "$i
euare-accountcreate --region $REGION -a $i
euare-useraddloginprofile --region $REGION --as-account $i -u admin -p mypassword$k
@dkavanagh
dkavanagh / switchbranch.sh
Created February 5, 2013 20:48
This script is called by passing in a new branch name. It is used by eucalyptus where we have sub-modules that require updating as well as the top level refs. Errors will cause things to stop (like changes not checked in).
git submodule foreach git checkout $1
git submodule foreach git pull origin $1
git checkout $1
git pull origin $1
@dkavanagh
dkavanagh / pushtoremote.sh
Last active July 15, 2016 15:28
pushtoremote.sh - I revised this to work with the current branch because I never ended up passing in anything other than that.
branch=`git rev-parse --abbrev-ref HEAD`
if [ "$branch" = "master" ] || [ "$branch" = "maint-4.1" ]
then
echo "Pushing to "$branch" is no bueno."
exit -1
fi
echo "pushing to "$branch
git submodule foreach git push origin $branch
git push origin $branch
@dkavanagh
dkavanagh / shareimages.sh
Created May 22, 2013 13:03
make all images public (ec2, eucalyptus)
for i in `euca-describe-images | awk '{ print $2; }'`
do
echo $i
euca-modify-image-attribute -l -a all $i
done
@dkavanagh
dkavanagh / http redirect example
Last active December 18, 2015 09:18
http redirector that works with tornado. start_redirector (in my code) gets called in a background thread.. ignore the callback arg, which is None, but kwargs is passed in containing use_ssl and port as values for the redirect handler.
def start_redirector(kwargs, callback):
# can't use tornado for this (not threadsafe). Must use something else, something simpler!
http_port = 8888
if eucaconsole.config.has_option('server', 'http.port'):
http_port = eucaconsole.config.getint('server', 'http.port')
server = BaseHTTPServer.HTTPServer(('localhost', http_port),
lambda *args: RedirectHandler(kwargs, *args))
server.serve_forever()
class RedirectHandler(BaseHTTPRequestHandler):
@dkavanagh
dkavanagh / pullupdates.sh
Created June 12, 2013 18:05
pullupdates.sh
branch=`git rev-parse --abbrev-ref HEAD`
echo "pulling from "$branch
git submodule foreach git pull origin $branch
git pull origin $branch
@dkavanagh
dkavanagh / cloud-config-eucaconsole.txt
Created April 30, 2014 13:57
This script installs the eucalyptus management console on a centos instance. Edit the IP on line 10 to refer to the proper eucalyptus back end.
#cloud-config
# vim: syntax=yaml
#
# This config installs the eucalyptus and epel repos, then installs and
# configures the eucaconsole package
runcmd:
- [ yum, -y, install, "http://downloads.eucalyptus.com/software/eucalyptus/nightly/4.0/centos/6/x86_64/eucalyptus-release-4.0-0.1.el6.noarch.rpm" ]
- [ yum, -y, install, eucaconsole ]
- [ sed, -i, "s/localhost/10.111.5.78/", /etc/eucaconsole/console.ini ]
@dkavanagh
dkavanagh / cloud-config-eucaconsole.txt
Created June 11, 2014 18:08
Cloud Init script for the Eucalyptus Management console
#cloud-config
# vim: syntax=yaml
#
# This config installs the eucalyptus and epel repos, then installs and
# configures the eucaconsole package
runcmd:
- [ yum, -y, install, "http://downloads.eucalyptus.com/software/eucalyptus/nightly/4.0/centos/6/x86_64/eucalyptus-release-4.0-0.1.el6.noarch.rpm" ]
- [ yum, -y, install, eucaconsole ]
- [ sed, -i, "s/localhost/10.111.5.78/", /etc/eucaconsole/console.ini ]