Skip to content

Instantly share code, notes, and snippets.

View igrigorik's full-sized avatar
:octocat:

Ilya Grigorik igrigorik

:octocat:
View GitHub Profile
export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=1000000000
export RUBY_HEAP_FREE_MIN=500000
@tmm1
tmm1 / gist:648512
Created October 27, 2010 05:37
http proxymachine api brainstorm
# load balancing
# send incoming requests to one of 10 backends running on ports 5000-5009
HttpProxyMachine.start do
{ :host => 'localhost', :port => 5000 + rand(10) }
end
# host based routing
# send requests for media.server/file to localhost:3000/media/file
# all other requests are unmodified
HttpProxyMachine.start do |request|
@woodie
woodie / .SETUP
Created November 23, 2010 08:23
gem install dubious
$ sudo jruby -S gem install dubious
Successfully installed bitescript-0.0.7
Successfully installed mirah-0.0.4-java
Successfully installed thor-0.13.8
Successfully installed activesupport-3.0.3
Successfully installed i18n-0.4.2
Successfully installed appengine-sdk-1.3.8
Successfully installed dubious-0.0.1-java
7 gems installed
@headius
headius / gist:727684
Created December 3, 2010 23:01
A GIL for JRuby?
~/projects/jruby ➔ # single thread performance
~/projects/jruby ➔ jruby --server bench/bench_threaded_reverse.rb 1
...
concurrency is - 1
started thread 0
Thread 0 running
another 10 in #<Thread:0xc8c7d6 run>
another 10 in #<Thread:0xc8c7d6 run>
another 10 in #<Thread:0xc8c7d6 run>
require 'strscan'
class Keylog
def convert(input)
output = ""
scan(input) {|s| output << s }
output
end
def count_keys(input)
keys = 0
@brixen
brixen / memory.rb
Created February 18, 2011 21:56
Easy tool for checking how much memory Rubinius uses
$ rbx memory.rb
memory used: 19.4M
$ bin/mspec ci -T -rmemory core/array
rubinius 1.2.1 (1.8.7 cdbdd275 2011-02-15 JI) [i686-apple-darwin9.8.0]
................................................................................................................
Finished in 3.992361 seconds
112 files, 2166 examples, 4420 expectations, 0 failures, 0 errors
@mnot
mnot / kindle_my_rfc.sh
Created March 12, 2011 01:06
Quick and dirty way to get Internet-Drafts onto your kindle
#!/bin/sh
# Kindle My RFC (or Internet-Draft)
#
# Sends an Internet Draft to your kindle
# Invocation:
# > kindle_my_rfc [path/to/rfc2629-xml-file]
# > kindle_my_rfc [draft-name-with-number-00]
#
# Requires:
@michaelbernstein
michaelbernstein / extconf.rb
Created March 27, 2011 19:55
My snappy wrapper from earlier in the week to show igrigorik
require 'mkmf'
# Give it a name
extension_name = 'lrsnappy'
# The destination
dir_config(extension_name)
$LIBS << " -lstdc++ -lsnappy"
@carsonmcdonald
carsonmcdonald / gist:911761
Created April 9, 2011 20:48
node.js SPDY proxy
var tls = require('tls');
var fs = require('fs');
var Buffer = require('buffer').Buffer;
var zlib = require('zlib');
var BufferList = require('bufferlist');
var Binary = require('bufferlist/binary');
var Put = require('put');
var http = require('http');
var options =
@carsonmcdonald
carsonmcdonald / revspdynpn.sh
Created April 27, 2011 14:52
How to set up ruby, eventmachine and spdy to use NPN
#
# Get development tools installed
#
sudo yum install -y git cvs zlib-devel
sudo yum groupinstall -y "Development Tools"
#
# Install RVM
#
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)