Skip to content

Instantly share code, notes, and snippets.

View fujin's full-sized avatar

AJ Christensen fujin

  • Rotorua, New Zealand
View GitHub Profile
@fujin
fujin / *scratch*
Created April 14, 2010 05:18 — forked from dysinger/*scratch*
#!/bin/sh
# Demo how your can merge opscode chef-repo & cookbooks
# and perm. keep up to date with opscode cookbooks (list line)
% git clone git://github.com/opscode/chef-repo.git
Initialized empty Git repository in /home/tim/src/chef-repo/.git/
remote: Counting objects: 107, done.
remote: Compressing objects: 100% (99/99), done.
remote: Total 107 (delta 45), reused 0 (delta 0)
Receiving objects: 100% (107/107), 16.14 KiB, done.
Resolving deltas: 100% (45/45), done.
@fujin
fujin / rvm-your-chef.rb
Created March 18, 2010 22:05 — forked from adamhjk/rvm-your-chef.rb
RVM your chef up
# Check this out, rvm use rbx
ruby_block "rvm use rbx" do
block do
Chef::Mixin::Command.popen4('bash -l -c "rvm use 1.9.1 && env"') do |p,i,o,e|
o.each_line do |line|
env_bits = line.split("=")
ENV[env_bits[0]] = env_bits[1]
end
end
@fujin
fujin / client.rb
Created December 30, 2009 10:56 — forked from brynary/client.rb
the Chef client.rb config that sucks instance data
# Chef Client Config File
# Automatically grabs configuration from ohai ec2 metadata.
require 'ohai'
require 'json'
o = Ohai::System.new
o.all_plugins
chef_config = JSON.parse(o[:ec2][:userdata])
if chef_config.kind_of?(Array)
users Mash.new unless attribute?("users")
groups Mash.new unless attribute?("groups")
ssh_keys Mash.new unless attribute?("ssh_keys")
roles Mash.new unless attribute?("roles")
groups[:admin] = {:gid => 113}
roles[:chef] = {:groups => [:admin], :sudo_groups => [:admin]}
roles[:staff] = {:groups => [:admin], :sudo_groups => [:admin]}
def initialize(name, collection=nil, node=nil)
super(name, collection, node)
puts "Overridden initialize"
@provider = Chef::Provider::Tomcat6Application
end
actions :create, :delete
attribute :name, :kind_of => String, :name_attribute => true
attribute :config_dir, :kind_of => String
queue_host "localhost"
queue_password ""
queue_port 61613
queue_retry_count 5
queue_retry_delay 5
queue_user ""
queue_prefix nil
@fujin
fujin / gist:168556
Created August 16, 2009 04:32 — forked from damm/gist:168555
set.users({
:bob => {
:gecos => "Brash Deploy User",
:shell => "/bin/bash",
:home => "/home/deploy"
}
}
)
@fujin
fujin / hehe.cs
Created August 10, 2009 13:07 — forked from anonymous/gist:165179
try
{
DataTable dt = new DataTable();
if (d.ItemsSource is IEnumerable)
{
IEnumerable items = d.ItemsSource as IEnumerable;
List<string> propertyNames = new List<string>();
foreach (object o in items)
{
ase node[:platform]
when "debian", "ubuntu"
%w{automake autoconf libtool subversion-tools help2man build-essential erlang libicu38 libicu-dev libreadline5-dev checkinstall libmozjs-dev wget libcurl4-gnutls-dev}.each {|pkg| package(pkg) }
end
execute "download_couchdb" do
user "root"
cwd "/tmp"
command "wget http://mirror.public-internet.co.uk/ftp/apache/couchdb/0.9.1/apache-couchdb-0.9.1.tar.gz"
creates "/tmp/apache-couchdb-0.9.1.tar.gz"
#!/usr/bin/ruby
# Requirements
require "csv"
file = File.open("/tmp/play.dot","w")
file.puts "graph G { "
#file.puts "\trankdir=LR "
file.puts "\tratio=expand;"