Skip to content

Instantly share code, notes, and snippets.

View anotherjesse's full-sized avatar

Jesse Andrews anotherjesse

View GitHub Profile
require 'rubygems'
require 'sinatra'
require 'dm-core'
DataMapper.setup(:default, ENV['DATABASE_URL'] || 'sqlite3://my.db')
module Activity
class Dogs
include DataMapper::Resource
@anotherjesse
anotherjesse / riak_wiki.rb
Created February 8, 2010 23:11
simple riak powered wiki
require 'rubygems'
require 'sinatra'
require 'rest_client'
require 'json'
RIAK_SERVER = "192.168.2.2"
get '/:bucket' do
keys = JSON.parse(RestClient.get "http://#{RIAK_SERVER}:8098/raw/#{params[:bucket]}")['keys']
"<ul>" + keys.collect { |k| "<li><a href='/#{params[:bucket]}/#{k}'>#{k}</a>" }.join('')
@anotherjesse
anotherjesse / relay.app
Created March 23, 2010 22:42
tcp relay in erlang
{application, relay,
[{description, "relay"},
{vsn, "0.01"},
{modules, [
relay_app,
relay_listener,
relay_sup,
relay_worker
]},
{registered, []},
@anotherjesse
anotherjesse / build-event-xml.rb
Created December 26, 2010 00:10
get a list of bzr branches from launchpad, then create an event.xml for ripary
#!/usr/bin/env ruby
require 'date'
require 'time'
$all_events = {}
class Event
attr_reader :date, :branch, :filename
@anotherjesse
anotherjesse / keypairs.py
Created August 9, 2011 17:51
WIP of keypair extension
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#!/bin/bash
# This script exits on an error so that errors don't compound and you see
# # only the first error that occured.
# set -o errexit
# Print the commands being run so that we can see the command that triggers
# an error. It is also useful for following allowing as the install occurs.
set -o xtrace
@anotherjesse
anotherjesse / openstack.sh
Created October 11, 2011 18:59
devstack userdata for uec-oneiric images
#!/bin/sh
apt-get update
apt-get install git -y
git clone https://github.com/cloudbuilders/devstack.git
cd devstack
echo ADMIN_PASSWORD=stack4eva >> localrc
echo MYSQL_PASSWORD=mysql4eva >> localrc
echo RABBIT_PASSWORD=rabbit4eva >> localrc
echo SERVICE_TOKEN=12345678901234567890 >> localrc
./stack.sh
require 'rubygems'
require 'em-proxy'
require 'http/parser' # gem install http_parser.rb
require 'UUID'
# > ruby em-proxy-http.rb
# > curl --proxy localhost:9889 www.google.com
host = "0.0.0.0"
port = 9889
@anotherjesse
anotherjesse / boot.sh
Created December 14, 2011 17:33
let me know when the server is up
#!/bin/bash
while ! ssh -o ConnectTimeout=1 -o PasswordAuthentication=no $1 uptime; do
sleep 1
done
say the computer is a boot
#!/bin/sh
apt-get update
echo root:passwd | chpasswd
add-apt-repository ppa:juju/pkgs
apt-get update && apt-get install juju