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
include $(GOROOT)/src/Make.inc | |
GOFMT=gofmt -spaces=true -tabindent=false -tabwidth=4 | |
all: | |
$(GC) jsontest.go | |
$(LD) -o jsontest.out jsontest.$O | |
format: | |
$(GOFMT) -w jsontest.go |
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
ctrl-z | |
bg | |
touch /tmp/stdout | |
touch /tmp/stderr | |
gdb -p $! | |
# In GDB | |
p dup2(open("/tmp/stdout", 1), 1) | |
p dup2(open("/tmp/stderr", 1), 2) |
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
def tip(msg); puts; puts msg; puts "-"*100; end | |
# | |
# 30 Ruby 1.9 Tips, Tricks & Features: | |
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
# | |
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
tip "Ruby 1.9 supports named captures in regular expressions!" |
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
# config.ru | |
# | |
# The Heroku architecture is based on Thin, which is based on EventMachine. This means | |
# you can access the EventMachine API and make use of Thin's asynchronous extension to | |
# the rack API. | |
# | |
# This is a simple asynchronous rack backed app that will hold a request for 4 seconds | |
# and respond with "Hello". | |
# | |
# In theory an app structured like this should be able to handle a huge number of |
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 = |