Skip to content

Instantly share code, notes, and snippets.

View hunner's full-sized avatar

Hunter Haugen hunner

View GitHub Profile
@hunner
hunner / .gitconfig
Last active September 26, 2016 09:25
Pretty format `git lg`
[alias]
# See http://cat.pdx.edu/~hunner/git-lg.png for an example
lg = "log --decorate --pretty=format:'%C(yellow)%h%C(reset) %C(green)%G?%C(reset) %C(blue)%an%C(reset) %C(cyan)%cr%C(reset) %s %C(auto)%d%C(reset)' --graph --date-order"
@hunner
hunner / .gvimrc
Created February 17, 2011 00:26
Simple file for MacVim and auto-indentation
filetype indent on
set expandtab
set tabstop=4
set shiftwidth=4
set autoindent
set smartindent
#!/usr/bin/env python
"""
Last.fm scrobbling for Pianobar, the command-line Pandora client. Requires Pianobar, Python, pyLast and Last.fm API credentials.
https://github.com/PromyLOPh/pianobar/
http://code.google.com/p/pylast/
http://www.last.fm/api/account
Installation:
1) Copy this script and pylast.py to the Pianobar config directory, ~/.config/pianobar/, and make sure this script is executable
@hunner
hunner / gist:1032544
Created June 17, 2011 22:56
This is an example of procedural languages at work.
#!/usr/bin/env ruby
##
## Procedural languages:
##
a = []
w=File.readlines('/usr/share/dict/words')
r=(0..10);c=r.map{Hash.new(0)};r.each{|i|
@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