Skip to content

Instantly share code, notes, and snippets.

@nruth
nruth / cookie_steps.rb
Created July 21, 2010 17:16
Testing login "remember me" feature with Capybara (rack::test or selenium) - deleting the session cookie (only)
@frsyuki
frsyuki / my_thoughts_on_msgpack.md
Created June 11, 2012 02:36
My thoughts on MessagePack

My thoughts on MessagePack

Hi. My name is Sadayuki "Sada" Furuhashi. I am the author of the MessagePack serialization format as well as its implementation in C/C++/Ruby.

Recently, MessagePack made it to the front page of Hacker News with this blog entry by Olaf, the creator of the Facebook game ZeroPilot. In the comment thread, there were several criticisms for the blog post as well as MessagePack itself, and I thought this was a good opportunity for me to address the questions and share my thoughts.

My high-level response to the comments

To the best of my understanding, roughly speaking, the criticisms fell into the following two categories.

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@frimik
frimik / puppetmaster.conf
Created September 15, 2012 13:00
Apache mod_disk_cache + mod_expires for 30x to 400x faster puppet file_metadata* requests.
# Several other articles written about similar setups but
# this seems like the most simple one if you're already using
# Passenger under Apache
#
# http://paperairoplane.net/?p=380
# http://www.masterzen.fr/2010/03/21/more-puppet-offloading/
#
# Add %D for "The time taken to serve the request, in microseconds."
@ysb33r
ysb33r / RelativePath.groovy
Last active November 4, 2022 14:18
The Groovy way to obtain a relative path given two paths.
def root= new File('/usr/share')
def full= new File('/usr/share/docs/rpm-4.4')
// Print the relative path of 'full' in relation to 'root'
// Notice that the full path is passed as a parameter to the root.
def relPath= new File( root.toURI().relativize( full.toURI() ).toString() )
@joemiller
joemiller / raid_ephemeral.sh
Last active October 23, 2023 21:53
detect all ephemeral disks on EC2 then stripe together in a raid-0 vol mounted at /mnt
#!/bin/bash
#
# this script will attempt to detect any ephemeral drives on an EC2 node and create a RAID-0 stripe
# mounted at /mnt. It should be run early on the first boot of the system.
#
# Beware, This script is NOT fully idempotent.
#
METADATA_URL_BASE="http://169.254.169.254/2012-01-12"
@esycat
esycat / PrettyPrinter.groovy
Last active June 11, 2024 12:18
A simple way to pretty print nested lists and maps in Groovy.
import static groovy.json.JsonOutput.*
def config = ['test': 'lalala']
println prettyPrint(toJson(config))
@benjamine
benjamine / github-tag
Last active August 1, 2017 17:37
move a git tag remotely using github API (avoiding any clone or fetch)
#!/bin/sh
#
# moves a tag in a github repo
#
# Usage: github-tag <tag-name> <ref> <apirepourl>
#
# Examples:
# github-tag env-staging heads/release https://usertoken@api.github.com/repos/user/reponame
# github-tag env-production tags/env-staging https://usertoken@api.github.com/repos/user/reponame
if [ $# -lt 3 ]
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active June 16, 2024 13:44
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

# Transfer files to a host in the NodeSet.
def rcp(opts)
dest = opts[:d].name
source = opts[:sp]
dest_path = opts[:dp]
fqdn = RSpec.configuration.rs_storage[:nodes][dest][:fqdn]
user = RSpec.configuration.rs_storage[:nodes][dest][:user]
# Grab a remote path for temp transfer
tmpdest = tmppath