Skip to content

Instantly share code, notes, and snippets.

View raggi's full-sized avatar

James Tucker raggi

View GitHub Profile
@raggi
raggi / description.md
Last active August 29, 2015 14:13
US Airways lost bags Jan 4, 2015

If you're currently waiting for your bags, because you flew sometime since the 4th of January 2015, and you came in via SFO: go to the airport they're there!

Customer service will tell you they're "with the delivery company" (they've been telling me this for three days). They'll tell you that "once it's with the delivery company, it goes to their warehouse" - there is no warehouse, at SFO it's ONE GUY as far as I can tell. They won't give you his name (it's Eddie - dial 650 652 5600 for an amusing full mailbox and "professional response" (it's been this way for over a year AFAICT - search around for the company name)). The company is called "Sterling Baggage" (not "whereismysuitcase.com", which is run by Bags Inc. who are similarly knowledge-less at all public phone numbers). If you call the SFO office, the lady there will tell you "it's on it's way" (which is also a lie).

I took the risk, given I'd been told by everyone that it was "on it's way, today" for the last three days, of driving up there. I'm

@raggi
raggi / bin-compile
Created May 12, 2015 21:00
A "pure" Heroku buildpack for Golang, uses GOPATH, no Godep. Make in a repo with files under bin/detect and bin/compile
#!/bin/bash
BUILD_DIR=$1
CACHE_DIR=$2
ENV_DIR=$3
GOBALL=go1.4.1.linux-amd64.tar.gz
mkdir -p $CACHE_DIR
export PATH=$PATH:$CACHE_DIR/go/bin
@raggi
raggi / config.ru
Created November 19, 2008 03:28 — forked from lifo/gist:26399
#!/usr/bin/env thin -e production -R config.ru -V start
# config.ru
# N.B. Rack::Lint doesn't yet support the api, use production mode rack.
require 'eventmachine'
class AsyncApp
class DeferrableBody
include EventMachine::Deferrable
@raggi
raggi / gist:61367
Created February 10, 2009 12:36 — forked from tmm1/gist:61014
class FiberedMutex
#
# Creates a new FiberedMutex
#
def initialize
@waiting = []
@locked = false
end
#
@raggi
raggi / gist:79926
Created March 16, 2009 15:26
Example implementation for Sinatra::Async, to be used with async thin
# async_sinatra_example.ru
require 'sinatra'
# Normally Sinatra::Base expects that the completion of a request is
# determined by the block exiting, and returning a value for the body.
#
# In an async environment, we want to tell the webserver that we're not going
# to provide a response now, but some time in the future.
#
# The a* methods provide a method for doing this, by informing the server of
@raggi
raggi / gist:80247
Created March 17, 2009 02:47
eventmachine postgres to sequel async shim
# I stole this code from em-mysql (tmm1 <3)
module Sequel
class Database
attr_accessor :_async
end
class Dataset
def async_insert *args, &cb
db._async.insert insert_sql(*args), &cb
nil
@raggi
raggi / gdb_stack_size.rb
Created April 30, 2009 02:40
show the effects of stack size on ruby's performance
#!/usr/bin/env ruby
require "benchmark"
bit64 = 1.size == 8
open('gdb-script', 'w') do |f|
f.puts <<-EOS
p ((unsigned int)rb_gc_stack_start - (unsigned int)$#{bit64 ? 'r' : 'e'}sp)
detach
@raggi
raggi / cranking.rb
Created May 29, 2009 02:20
EventMachine.crank
require 'thread'
module EventMachine
module Test
module Utils
module Cranking
# Stolen from MenTaLguYs Omnibus
class Waiter
def initialize
require "benchmark"
class Hash
# Performs the opposite of <tt>merge</tt>, with the keys and values from the first hash taking precedence over the second.
def reverse_merge(other_hash)
other_hash.merge(self)
end
# Performs the opposite of <tt>merge</tt>, with the keys and values from the first hash taking precedence over the second.
# Modifies the receiver in place.
def reverse_merge!(other_hash)
@raggi
raggi / return.rb
Created June 18, 2009 17:04 — forked from lifo/return.rb
module Enumerable
def return
each do |i|
value = yield(i)
return value if value
end
nil
end
end