Skip to content

Instantly share code, notes, and snippets.

View timshadel's full-sized avatar

Tim Shadel timshadel

View GitHub Profile

Ask curl to connect to localhost, but send the Host header with a different value

$ curl -H "Host: fake.com" http://localhost:8585

curl will hang until you kill the server.

@timshadel
timshadel / add-friend.json
Created November 13, 2012 19:22
What makes it media?
{
"template": {
"prompt_src": "graph:|profile/facebook.com|propmts:friends:connect#confirm_required",
"input": {
"name": "gref",
"prompt_src": "graph:|profile/facebook.com|propmts:friends:connect#gref",
"required": true,
"type": "gref"
},
"input": {
@timshadel
timshadel / src-head.json
Created November 13, 2012 18:39
Idea for using src + HTTP HEAD or GET with Accept headers for embedding items into Collection+JSON
{ "collection" :
{
"version" : "1.0",
"href" : "http://example.org/friends/",
"items" :
[
{
"href" : "...",
"data" :
@timshadel
timshadel / src+head.json
Created November 13, 2012 18:37
Idea for using src + HTTP HEAD or GET with Accept headers for embedding items into Collection+JSON
{ "collection" :
{
"version" : "1.0",
"href" : "http://example.org/friends/",
"items" :
[
{
"href" : "...",
"data" :
@timshadel
timshadel / alias-bundle-exec.bash
Created September 22, 2011 05:04
Ideas for eliminating 'bundle exec' when using rbenv
#!/usr/bin/env bash
#
# Put this in ~/.rbenv/rbenv.d/init/
# Based in part on http://twistedmind.com/bundle-exec-bash-shortcut
# For a completely different take, see https://github.com/carsomyr/rbenv-bundler
#
# Slower. More correct? Choosing faster one for now.
# echo bundled_bins=\(`rbenv exec ruby -rbundler/setup -e 'puts Bundler.rubygems.all_specs.map{|s| s.executables}.flatten.join(" ")'`\)
# Only aliases executable names of the global Ruby. Cheap way to `rbenv exec` in every version?
@timshadel
timshadel / make_video.sh
Created February 11, 2011 18:50
Create a Gource visualization of the Rails codebase as it crosses into GitHub land...
# On a Mac
# brew install gource (http://code.google.com/p/gource/)
# brew install ffmpeg
# git clone https://github.com/rails/rails.git
# In the rails code directory, run this to see the same visualization
gource --hide bloom,files,filenames,dirnames --auto-skip-seconds 0.3 --seconds-per-day 0.003 --date-format "%B %Y" --start-position 0.2 --stop-position 0.45 --file-idle-time 10 --stop-at-end -1024x768
# Or do this to save it to a reusable video:
gource --hide bloom,files,filenames,dirnames --auto-skip-seconds 0.3 --seconds-per-day 0.003 --date-format "%B %Y" --start-position 0.2 --stop-position 0.45 --file-idle-time 10 --stop-at-end -1024x768 -o - | ffmpeg -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -vpre slow -threads 0 rails-on-github.mp4
@timshadel
timshadel / .bak.yml
Created January 7, 2011 21:55
Back up old files to an archive directory. Configurable with multiple dirs. It'll zip up directories when archiving.
trash: ~/.Trash
default: w
dirs:
w: ~/work/myjob/archive
p: ~/Dropbox/Archive
o: /path/to/other/archive
@timshadel
timshadel / 0-prep.txt
Created December 26, 2010 03:41
Grab my home brew branch on the mini
the-mini:~ $ cd /usr/local/
the-mini:local (master) $ git remote -v
the-mini:local (master) $ git pull https://github.com/timshadel/homebrew.git
remote: Counting objects: 8, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 3), reused 0 (delta 0)
Unpacking objects: 100% (5/5), done.
From https://github.com/timshadel/homebrew
* branch HEAD -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
@timshadel
timshadel / grails_app_time.txt
Created November 23, 2010 05:52
Why is grails so much slower than rails? (OK, it's the probably JVM startup time and Java toolset) Then why is it so exciting?
$ time grails create-app qotd
Welcome to Grails 1.3.4 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/local/Cellar/grails/1.3.4
Base Directory: /Users/tim/work/ssi/consulting/learn
Resolving dependencies...
Dependencies resolved in 1143ms.
Running script /usr/local/Cellar/grails/1.3.4/scripts/CreateApp_.groovy
Environment set to development
#!/usr/bin/env macruby
# From: http://www.stompy.org/2008/08/14/xcode-and-git-another-build-script/
# Expanded from here: http://www.furmanek.net/36/using-macruby-to-set-xcode-project-version-from-git/
# Xcode auto-versioning script for Subversion by Axel Andersson
# Updated for git by Marcus S. Zarra and Matt Long
# Converted to ruby by Abizern
# Converted to MacRuby by Gregory Furmanek
# Merged with MacRuby version by elliottcable
# Dirty handling, style and build-only version update by timshadel