Skip to content

Instantly share code, notes, and snippets.

View hunner's full-sized avatar

Hunter Haugen hunner

View GitHub Profile
@hunner
hunner / gist:1076824
Created July 11, 2011 21:26
RVM on OS X for zsh
# Install git via macports or homebrew...
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> .zshrc
source .zshrc
rvm notes # This will tell you about the following commands
rvm install 1.8.7
rvm system
rvm gemset export system.gems
rvm 1.8.7
@hunner
hunner / keys.rb
Created November 8, 2011 00:47
Simple keys() function for puppet
# <module>/lib/puppet/parser/functions/keys.rb
Puppet::Parser::Functions::newfunction(:keys, :type => :rvalue) do |args|
args.collect { |h| h.keys if h.is_a?(Hash) }.flatten.compact
end
### output
err: /Stage[main]/Keymanager/File[keymanager_dbyml]/ensure: change from absent to file failed: Could not set 'file on ensure: No such file or directory - /mnt/apigee/keymanager/current/config/database.yml.puppettmp_5679 at /etc/puppet/modules/keymanager/manifests/init.pp:60
notice: /Stage[main]/Keymanager/File[keymanager_current]/ensure: created
### manifest
file {
"keymanager_current":
path => "${apigeemnt}/keymanager/current",
ensure => link,
owner => apache,
notice: /Stage[main]/Analytics::Reportingserver/File[/mnt/apigee/analytics/database/postgresql.conf]/mode: mode changed '600' to '644'
info: /Stage[main]/Analytics::Reportingserver/File[/mnt/apigee/analytics/database/postgresql.conf]: Scheduling refresh of Service[postgresql]
info: /Stage[main]/Analytics::Reportingserver/File[/mnt/apigee/analytics/database/postgresql.conf]: Scheduling refresh of Service[postgresql]
notice: /Stage[main]/Postgresql/Service[postgresql]/ensure: ensure changed 'stopped' to 'running'
err: /Stage[main]/Postgresql/Service[postgresql]: Failed to call refresh: Could not restart Service[postgresql]: Execution of '/sbin/service postgresql restart' returned 1: at /etc/puppet/modules/postgresql/manifests/init.pp:47
do shell script ("hdiutil attach -mountpoint ~/Documents/work ~/Documents/Work.sparsebundle")
tell application "Finder"
activate
make new Finder window
select Finder window 1
set target of Finder window 1 to disk "work"
end tell
@hunner
hunner / ec2.rb.diff
Created November 14, 2011 20:04
EC2 fix
diff --git a/lib/facter/ec2.rb b/lib/facter/ec2.rb
index c52f76b..ebfdcff 100644
--- a/lib/facter/ec2.rb
+++ b/lib/facter/ec2.rb
@@ -23,9 +23,8 @@ def metadata(id = "")
if key[-1..-1] != '/'
value = open("http://169.254.169.254/2008-02-01/meta-data/#{key}").read.
split("\n")
- value = value.size>1 ? value : value.first
symbol = "ec2_#{key.gsub(/\-|\//, '_')}".to_sym
[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
[epel-puppet]
name=epel puppet
[root@tdc00demo ~]# cat /etc/settings.php
<?php
$db_url = 'mysqli://user:pass@host/database';
?>
[root@tdc00demo ~]# cat settings_php.augtool
set /augeas/load/Phpvars/incl[last()+1] "/etc/settings.php"
load
[root@tdc00demo ~]# augtool --noload -if settings_php.augtool
augtool> print /augeas/load/Phpvars
/augeas/load/Phpvars
[root@training manifests]# puppet apply alpha.pp
notice: beta
notice: /Stage[before]/Beta/Notify[beta]/message: defined 'message' as 'beta'
notice: alpha
notice: /Stage[before]/Alpha/Notify[alpha]/message: defined 'message' as 'alpha'
notice: gamma
notice: /Stage[main]/Gamma/Notify[gamma]/message: defined 'message' as 'gamma'
notice: Finished catalog run in 0.08 seconds
[root@training manifests]# cat alpha.pp
stage { 'before': before => Stage['main'], }
hostclass 'jetty::services' do
#{
# "zakenregister-1.0"=>{"instances"=>"2", "groupid" => "nl.cjib.jetty"},
# "zakenregister-2.0"=>{"instances"=>"2", "groupid" => "nl.cjib.jetty"},
# "zakenregister-2.2"=>{"instances"=>"4", "groupid" => "nl.cjib.jetty"},
# "somethingelse-2.2"=>{"instances"=>"4", "groupid" => "nl.cjib.jetty"}
#}
services = scope.function_hiera_hash("services")
nexus_repo_url = scope.function_hiera("nexus_repo_url")
services.each do |service_version, params|