Skip to content

Instantly share code, notes, and snippets.

View jtimberman's full-sized avatar
🚀

Joshua Timberman jtimberman

🚀
View GitHub Profile
@jtimberman
jtimberman / gist:9837538
Created March 28, 2014 16:55 — forked from jsierles/gist:84082
The original "knife" - a Thor task file for interacting with a Chef Server API, ca. the Stone Age of Chef :).
#!/usr/bin/ruby
#
# Joshua Sierles, 37signals, 2009
require 'rubygems'
require 'thor'
require 'chef'
require 'chef/node'
require 'chef/rest'
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
do shell script "xcode-select --install"
do shell script "sleep 1"
tell application "System Events"
tell process "Install Command Line Developer Tools"
keystroke return
click button "Agree" of window "License Agreement"
end tell
end tell
[user]
name = Joshua Timberman
email = joshua@housepub.org
[color]
ui = true
diff = true
status = true
branch = true
interactive = true
[core]
save-last-command() {
last_command=$(fc -nl 0)
command_name="$1"
read -r -d '' new_fun <<EOF
${command_name}() {
$last_command
}
EOF
eval "$new_fun"
}
require 'chef/log'
require 'pry'
module ChefSoftware
class CookbookVersionsHandler < Chef::Handler
def report
Chef::Log.info('Pausing in handler to run pry; type "exit" to leave pry')
binding.pry
end
@jtimberman
jtimberman / ec2.rb
Created October 17, 2008 05:09 — forked from adamhjk/ec2.rb
undefined
task :classify_nodes do
@dns_names.each do |description|
description =~ /^(.+?)\..+$/
hostname = $1
node = @ic.get_node(hostname)
if exists?(:puppet_env)
EC2_DATA[:iclassify_attribs]["puppet_env"] = puppet_env
end
node.tags = EC2_DATA[:iclassify_tags]
EC2_DATA[:iclassify_attribs].each do |name, values|
#!/bin/sh
#
# EC2 bootstrap
#
mkdir /etc/chef
mkdir /var/chef
cat > /etc/chef/solo.rb <<SOLO
cookbook_path "/var/chef/cookbooks"
define :mysql_database, :action => 'create' do
def mysql(command, config=nil, )
"mysql --defaults-file=#{config} --execute=#{command.inspect}"
end
include_recipe "mysql::client"
# For now, use the super-user conf
case @node[:platform]
when "debian", "ubuntu"
class TestCLI
include Mixlib::CLI
option :config_file,
:short => "-c CONFIG",
:long => "--config CONFIG",
:default => 'config.rb',
:description => "The configuration file to use"
option :log_level,