Skip to content

Instantly share code, notes, and snippets.

require 'rubygems'
puts ENV["GEM_HOME"]
require 'mongoid'
require 'mongoid/version'
class RapSupahStah
include Mongoid::Document
cache
attr_accessor :mode
@jcoene
jcoene / strangle_itunes_match.sh
Created September 9, 2011 06:21
Why would Steve do this to me?
sudo ipfw pipe 1 config bw 80KByte/s
sudo ipfw add 1 pipe 1 dst-ip 72.21.0.0/16 dst-port 443
sudo ipfw add 2 pipe 1 dst-ip 17.152.0.0/16 dst-port 443
#!/usr/bin/ruby
# This program adds up the numbers 1 through 10,000 using 100 threads.
# Challenge A: Does this solution have any problems? If so, explain.
# Challenge B: Propose an alternate implementation that does not use threads.
require "thread"
mt_result = 0
@jcoene
jcoene / riakpbc-close-test.go
Created February 23, 2014 01:38
riakpbc panic test case
package main
import (
"fmt"
"log"
"github.com/mrb/riakpbc"
)
func main() {
package benchcmpvsnil
import (
"testing"
)
func BenchmarkNilPtrNil(b *testing.B) {
for i := 0; i < b.N; i++ {
isNilPtr(nil)
}
@jcoene
jcoene / glide-install.sh
Created March 15, 2016 16:41
glide-install
#!/usr/bin/env bash
set -e
# You can override GLIDE_VERSION to get a different version
GLIDE_VERSION=${GLIDE_VERSION:-0.9.3}
# Try to auto-detect kernel and arch
KERNEL=`uname -s | awk '{print tolower($0)}'`
ARCH=`uname -m`
{
"all_heroes": {
"assists_healing_done": 109494,
"assists_recon_assists": 10,
"assists_teleporter_pads_destroyed": 1,
"average_damage_done_average": 5640,
"average_deaths_average": 6.04,
"average_eliminations_average": 13.03,
"average_final_blows_average": 7.28,
"average_healing_done_average": 905,