This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'strscan' | |
class Keylog | |
def convert(input) | |
output = "" | |
scan(input) {|s| output << s } | |
output | |
end | |
def count_keys(input) | |
keys = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mkmf' | |
# Give it a name | |
extension_name = 'lrsnappy' | |
# The destination | |
dir_config(extension_name) | |
$LIBS << " -lstdc++ -lsnappy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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) |