Skip to content

Instantly share code, notes, and snippets.

View jeffmccune's full-sized avatar

Jeff McCune jeffmccune

View GitHub Profile
@jeffmccune
jeffmccune / fsck_me.rb
Created December 7, 2011 04:51
Urge to kill rising...
class String
ZAML_ESCAPES = %w{\x00 \x01 \x02 \x03 \x04 \x05 \x06 \a \x08 \t \n \v \f \r \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \e \x1c \x1d \x1e \x1f }
def escaped_for_zaml
gsub( /\x5C/u, "\\\\\\" ). # Demi-kludge for Maglev/rubinius; the regexp should be /\\/ but parsetree chokes on that.
gsub( /"/u, "\\\"" ).
gsub( /([\x00-\x1F])/u ) { |x| ZAML_ESCAPES[ x.unpack("C")[0] ] }.
gsub( /([\x80-\xFF])/n ) { |x| "\\x#{x.unpack("C")[0].to_s(16)}" }
end
end
@jeffmccune
jeffmccune / repair_mac_ruby_links.sh
Created December 1, 2011 17:26
Repair Mac OS X Ruby Symlinks
@jeffmccune
jeffmccune / gist:1411574
Created November 30, 2011 22:49
Puppet Gemset
[jeff@maynard] 1.8.7 ~
% rvm gemset use puppet
[jeff@maynard] 1.8.7@puppet ~
% gem list
albino (1.3.3)
blockenspiel (0.4.2)
builder (3.0.0)
CFPropertyList (2.0.17)
columnize (0.3.2)
configuration (1.2.0)
@jeffmccune
jeffmccune / .fog
Created November 14, 2011 17:23
Fog YAML Configuration for PE 2.0
:default:
:vsphere_server: vc01.puppetlabs.lan
:vsphere_username: jeffapi
:vsphere_password: abc123
:vsphere_expected_pubkey_hash: 431dd5d0412aab11b14178290d9fcc5acb041d37f90f36f888de0cebfffff0a8
:aws_access_key_id: AKIAIISJV5TZ3FPWU3TA
:aws_secret_access_key: XXXXXXXXXXXXXXXXXXXXXXXX
@jeffmccune
jeffmccune / gist:1335043
Created November 2, 2011 21:52
Puppet Laptop Environment

rspec run

[jeff@maynard] (master)(clean) 1.8.7@ckcp /vagrant/modules/cloud-provisioner 
% rspec spec/**/*_spec.rb

RVM

% rvm current
ruby-1.8.7-p334@ckcp
@jeffmccune
jeffmccune / gist:1310371
Created October 24, 2011 21:29
Incrementing environment variables

The test Script

#! /bin/bash
set -x
set -e
set -u
idx=0
((idx++))
echo "rval: $?"

echo "idx: $idx"

@jeffmccune
jeffmccune / gist:1223382
Created September 16, 2011 23:12
List AWS Key Names
[jeff@light] 1.8.7@ckcp ~ 1 ↵
% puppet node_aws create --image ami-2342a94a --keyname jeffdne --type t1.micro
err: Unrecognized key name: jeffdne (Suggestion: use the puppet node_aws list_keynames action to find a list of valid key names for your account.)
err: Try 'puppet help node_aws create' for usage
[jeff@light] 1.8.7@ckcp ~ 1 ↵
% puppet node_aws list_keynames
asdf
awsCFtest
cody
jeff
@jeffmccune
jeffmccune / find_template_by_instance_uuid.rb.diff
Created September 8, 2011 20:44
rbvmomi responses versus Excon responses
# What I'm doing to convert #
diff --git a/lib/fog/vsphere/requests/compute/find_template_by_instance_uuid.rb b/lib/fog/vsphere/requests/compute/find_template_by_instance_uuid.rb
index 3a1776b..21c289a 100644
--- a/lib/fog/vsphere/requests/compute/find_template_by_instance_uuid.rb
+++ b/lib/fog/vsphere/requests/compute/find_template_by_instance_uuid.rb
@@ -1,27 +1,35 @@
module Fog
module Compute
@jeffmccune
jeffmccune / screenrc
Created September 8, 2011 17:14
GNU Screen RC
defutf8 on
defflow off
vbell off
autodetach on
startup_message off
defscrollback 30000
# The hard status is updated by the zsh prompt commands.
# %t is populated by the shell sending 'print -nR $'\033k'$1$'\033'\\'
# %h is populated by the shell sending 'print -nR $'\033]0;'$2$'\a''
➜  puppet  puppet apply -v --modulepath /Users/jeff/src/manifests/modules{,/paramstest/tests/site.pp}
info: Applying configuration version '1308091819'
notice:  param=[I'm defined in paramstest::params] mandatory=[site.pp]
notice: /Stage[main]/Paramstest/Notify[TEST]/message: defined 'message' as ' param=[I'm defined in paramstest::params] mandatory=[site.pp]'
➜  puppet  git describe                                                                              
2.6.3