Skip to content

Instantly share code, notes, and snippets.

View saimonmoore's full-sized avatar

Saimon Moore saimonmoore

View GitHub Profile
@vgrichina
vgrichina / git-interactive-merge.sh
Created December 23, 2009 22:11
Interactive merge utility for Git, as described here http://www.angrylibertarian.com/node/53
#!/bin/bash
# git-interactive-merge
# Taken from: http://www.angrylibertarian.com/node/53
from=$1
to=$2
if [[ ( -z $from ) || ( -z $to ) ]]; then
echo "Usage:"
echo " git-interactive-merge <from-branch> <to-branch>"
exit 1
#!/custom/ree/bin/ruby
# USAGE:
#
# echo "|/path/to/core_helper.rb %p %s %u %g" > /proc/sys/kernel/core_pattern
#
require 'etc'
require 'net/smtp'
@tvandervossen
tvandervossen / .kick
Created October 12, 2010 20:18
Reload browser on save Kicker recipe
process do |files|
execute("osascript -e 'tell application \"WebKit\"
do JavaScript \"window.location.reload()\" in first document
end tell'")
end
@jrom
jrom / download-from-s3.rb
Created November 2, 2010 12:02
For downloading assets (in this case Paperclip attachments) from S3 to local filesystem
require 'aws/s3'
AWS::S3::Base.establish_connection!(
:access_key_id => 'id',
:secret_access_key => 'secret'
)
missing_uploads = [1,2,3,4] # ID's from the attachments you want to download
log = File.open('file-import-log.txt','w')
window.addEventListener "DOMContentLoaded", ->
body = $ "body"
canvas = $ "#canvas"
chalkboard = $ "#chalkboard"
close = $ "#close"
ledge = $ "#ledge"
lightswitch = $ "#lightswitch"
output = $ "#output"
shade = $ "#shade"
share = $ "#share"
@dchelimsky
dchelimsky / shared_example_group_rspec_2_workaround.rb
Created December 3, 2010 15:46
shared_example_group_rspec_2_workaround
# shared example groups in rspec-1 are evaluated in the example group that
# has it_should_behave_like.
#
# This behavior changed in rspec-2, in which it_should_behave_like generates a
# nested group. This means that a structure like this won't work as you expect
# in rspec-2
#
# shared_examples_for "logged in as admin" do
# before { login_as :admin }
# end
@creationix
creationix / inspect.js
Created December 23, 2010 06:51
a custom object inspector to help me understand JavaScript
function escapeString(string) {
string = string.replace(/\\/g, "\\\\").
replace(/\n/g, "\\n").
replace(/\r/g, "\\r").
replace(/\t/g, "\\t");
if (string.indexOf("'") < 0) {
return "'" + string + "'";
}
string = string.replace(/"/g, "\\\"");
return '"' + string + '"';
@bryanveloso
bryanveloso / puppet.txt
Created January 4, 2011 08:37
Links I've found while studying the world of Puppet.
http://about.digg.com/blog/master-puppets-2-speaking-language
http://agiletesting.blogspot.com/2009/11/automated-deployments-with-puppet-and.html
http://articles.itecsoftware.com/linux/install-and-configure-puppet-client-on-ubuntu-10-10
http://articles.itecsoftware.com/linux/install-and-configure-puppet-server-puppetmaster-on-ubuntu-10-10
http://bitfieldconsulting.com/puppet-and-mysql-create-databases-and-users
http://blog.credativ.com/en/2010/03/howto-introduction-to-puppet.html
http://blog.kumina.nl/2010/11/puppet-tipstricks-running-apt-get-update-only-when-needed/
http://en.gentoo-wiki.com/wiki/Puppet (the "User" portion)
http://evolvingweb.ca/story/controlling-your-cloud-puppet
http://library.linode.com/application-stacks/puppet/automation
########################################################################
### Rakefile for encrypted passwords
########################################################################
#
# Here's a little Rakefile to manage your encrypted password file! It's
# really easy to use:
#
# 1) put the email addresses of the keys you want in AUTHORIZED_USERS
# 2) create a passwords.txt (and ignore it in your SCM)
# 3) run `rake passwords:encrypt`
@saimonmoore
saimonmoore / bash function: execute command n times
Created March 31, 2011 22:13
A bash function that executes a command n (default 5) times
# Usage:
# $loopc echo 'hello world'
# hello world
# hello world
# hello world
# hello world
# hello world
#
#(i.e. defaults to 5 iterations)