Skip to content

Instantly share code, notes, and snippets.

View jeremyd's full-sized avatar

Jeremy D jeremyd

View GitHub Profile
@jeremyd
jeremyd / PKGBUILD
Created November 10, 2012 08:44
PKGBUILD for cloud-init-bzr take 2
pkgname=cloud-init-bzr
pkgver=723
pkgrel=1
pkgdesc="Bootstrap EC2 instances with Cloud-init from Canonical. Packaged from bzr trunk."
arch=(any)
license=("GPLv3")
url=https://launchpad.net/cloud-init
# cloud-init python lib requirements (according to Requires file):
# cheetah (aur), PrettyTable (aur), oauth (aur), boto (aur), configobj (community), pyyaml (community), argparse (aur)
# the ONLY non-match is we are using python2-yaml vs pyyaml.
@jeremyd
jeremyd / archlinux.cloud.cfg
Created November 10, 2012 07:41
cloud.cfg for archlinux
disable_root: false
preserve_hostname: false
# The modules that run in the 'init' stage
cloud_init_modules:
- bootcmd
- write-files
- set_hostname
- update_hostname
- update_etc_hosts
- users-groups
def self.load_preferences
e = getPreferences(Context::MODE_PRIVATE)
email = e.getString("Email", "")
pass = e.getString("Password", "")
host = e.getString("RightScale Host", "")
account_id = e.getString("Account ID", "")
return { :email => email, :pass => pass, :host => host, :account_id => account_id }
end
@jeremyd
jeremyd / snippit.rb
Created October 30, 2012 07:38
example http android jruby
# REST METHODS
# takes a block of HttpGet/Put/Post/Delete
def self.get(&block)
options = self.load_preferences
client = DefaultHttpClient.new
params = BasicHttpParams.new
HttpProtocolParams.setVersion(params, HttpVersion::HTTP_1_1);
HttpProtocolParams.setContentCharset(params, "UTF_8");
HttpProtocolParams.setUseExpectContinue(params, false);
client.setParams(params)
@jeremyd
jeremyd / PKGBUILD
Created October 29, 2012 01:45
PKGBUILD cloud-init-bzr
pkgname=cloud-init
pkgver=701
pkgrel=1
pkgdesc="cloud-init from canonical"
arch=(any)
license=("GPLv3")
depends=(systemd python2 python2-yaml python2-cheetah python2-prettytable python2-oauth2 python2-boto python2-argparse python2-configobj)
makedepends=('bzr' 'python2')
_bzrtrunk="lp:~jeremydei/cloud-init/archlinux"
_bzrmod="cloud-init"
@jeremyd
jeremyd / chef_server_bootstrap.rb
Created July 8, 2011 05:34
chef server bootstrap
#!/usr/bin/env ruby
puts `gem sources -a http://gems.opscode.com/`
puts `gem install chef`
solorb = <<EOF
file_cache_path "/tmp/chef-solo"
cookbook_path "/tmp/chef-solo/cookbooks"
recipe_url "http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz"
EOF
bootstrap = <<BOOT
@jeremyd
jeremyd / gist:863668
Created March 10, 2011 06:40
jruby on android thoughts ..
require 'ruboto'
ruboto_import "org.myname.example.MySQLiteOpenHelper"
#ruboto_import "org.ruboto.example.MyCursorAdapter"
#ruboto_import "org.ruboto.example.DepListActivity"
ruboto_import_widgets :LinearLayout, :TableLayout, :TableRow, :TextView, :EditText, :ScrollView
$activity.start_ruboto_activity("$dep_list_activity") do |bundle|
@jeremyd
jeremyd / gist:798807
Created January 27, 2011 17:06
ant compile error, GraphicsView
Buildfile: /home/jeremy/recent_projects/testapp/build.xml
[setup] Android SDK Tools Revision 8
[setup] Project Target: Android 2.2
[setup] API level: 8
[setup]
[setup] ------------------
[setup] Resolving library dependencies:
[setup] No library dependencies.
[setup]
[setup] ------------------
@jeremyd
jeremyd / gist:797817
Created January 27, 2011 00:22
cleanit!
def clean_and_translate_server_params(it)
it.each do |k, v|
clean_and_translate_server_params(val) if val.is_a?(Hash)
end
it.reject! { |k, v| v == nil || v == "" }
it.each { |k, v| v = translate_href(v) if k.to_s =~ /href/ }
it
end
def translate_href(href)
@jeremyd
jeremyd / gist:760069
Created December 30, 2010 18:07
use rest_connection w/out a config file
## One way to change the rest_connection settings using Ruby code.
RightScale::Api::BaseExtend.class_eval <<-EOF
@@connection.settings = {
:user => "someuser@rightscale.com",
:pass => "test1234_",
:api_url => "https://my.rightscale.com/api/acct/12345",
:common_headers => {
"X_API_VERSION" => "1.0"
}