Skip to content

Instantly share code, notes, and snippets.

View schisamo's full-sized avatar

Seth Chisamore schisamo

View GitHub Profile
@wk8
wk8 / readline.patch
Last active August 29, 2015 14:00
Minimal patch to get ruby 2.1.1 to compile with readline 6.3.x (?) on Mac OS X. Usage: curl -L https://gist.github.com/wk8/fef2479af6b16a9cac71/raw | ruby-build 2.1.1 --patch or curl -L https://gist.github.com/wk8/fef2479af6b16a9cac71/raw | rbenv install --patch 2.1.1, depending on what you're using.
--- ext/readline/readline.c
+++ ext/readline/readline.c
@@ -1974,7 +1974,7 @@ Init_readline()
rl_attempted_completion_function = readline_attempted_completion_function;
#if defined(HAVE_RL_PRE_INPUT_HOOK)
- rl_pre_input_hook = (Function *)readline_pre_input_hook;
+ rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;
#endif
#ifdef HAVE_RL_CATCH_SIGNALS
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"
}
@jkeiser
jkeiser / gist:126e7e1ed0b040ddc892
Created March 16, 2015 20:20
provisioning-machine
#
# First create a provisioners group so the ACLs are all correct
#
chef_group 'provisioners' do
end
# To be able to recreate the provisioners group
chef_acl 'groups' do
rights :create, groups: 'provisioners'
end
# To be able to add others to the provisioners group
@tmm1
tmm1 / iterator.rb
Created October 30, 2009 08:28
simple eventmachine async iterator
module EventMachine
# A simple iterator for concurrent asynchronous work.
#
# Unlike ruby's built-in iterators, the end of the current iteration cycle is signaled manually,
# instead of happening automatically after the yielded block finishes executing. For example:
#
# (0..10).each{ |num| }
#
# becomes:
#
#!/bin/bash
# Run iTerm.app once, quit & run script from Terminal.app
MONOKAI='{
"Ansi 0 Color" = {
"Blue Component" = 0.0;
"Green Component" = 0.0;
"Red Component" = 0.0;
};
current_dir = File.dirname(__FILE__)
platform = "https://api.opscode.com/organizations"
require 'grit'
branch = Grit::Repo.new("#{current_dir}/..").head.name
case branch
when "internal"
url = "http://virt1test.int.example.org:4000"
validator = ""
#!/usr/bin/env ruby
require 'rubygems'
require 'chef'
require 'chef/client'
require 'chef/run_context'
Chef::Config[:solo] = true
Chef::Config[:log_level] = :info
Chef::Log.level(:info)
#!/usr/bin/env ruby
require 'rubygems'
require 'chef'
require 'chef/client'
require 'chef/run_context'
Chef::Config[:solo] = true
Chef::Config[:log_level] = :info
Chef::Log.level(:info)
require 'chef'
require 'chef/node'
class Opscode
class Backup
attr_accessor :backup_dir
def initialize(backup_dir, config_file)
@backup_dir = backup_dir
Chef::Config.from_file(config_file)