Skip to content

Instantly share code, notes, and snippets.

# A Sinatra app that does the same thing
require 'rubygems'
require 'sinatra'
set :env, :production
get '/' do
"x" * (params[:size].to_i * 1024)
end
=ERROR REPORT==== 16-Sep-2008::15:40:14 ===
Error in process <0.189.0> on node 'foo@blake' with exit value: {emfile,[{erlang,open_port,[{spawn,"/bin/sh -s unix:cmd 2>&1"},[stream]]},{os,start_port,0},{os,'-unix_cmd/1-fun-0-',2}]}
** exception error: emfile
in function open_port/2
called as open_port({spawn,"/bin/sh -s unix:cmd 2>&1"},[stream])
in call from os:start_port/0
in call from os:'-unix_cmd/1-fun-0-'/2
erl -remsh noname@nohost
Erlang (BEAM) emulator version 5.6.3 [source] [async-threads:0] [hipe] [kernel-poll:false]
*** ERROR: Shell process terminated! (^G to start new job) ***
# Boilerplate Erlang build tasks in Rake
def set(name, val)
Kernel.instance_eval do
define_method(name) { val }
end
end
set :sname, ""
require 'rubygems'
require 'sinatra'
require 'sinatra/test/unit'
require 'app'
class MyAppTest < Test::Unit::TestCase
def test_hello_world
assert_equal :test, Sinatra.application.env
get_it '/'
assert @response.ok?
blake-2:~ blakemizerany$ gemi mechanize
ERROR: http://gems.datamapper.org does not appear to be a repository
ERROR: could not find gem mechanize locally or in a repository
["connected"]
["receive",
#<AMQP::Frame::Method:0x569474
@channel=0,
@payload=
#<AMQP::Protocol::Connection::Start:0x568718
@debug=1,
@locales="en_US",
@mechanisms="PLAIN AMQPLAIN",
blake-2:amqp blakemizerany$ ruby simple.rb
["connected"]
["receive",
#<AMQP::Frame::Method:0x5641cc
@channel=0,
@payload=
#<AMQP::Protocol::Connection::Start:0x56278c
@debug=1,
@locales="en_US",
["connected"]
["receive",
#<AMQP::Frame::Method:0x54702c
@channel=0,
@payload=
#<AMQP::Protocol::Connection::Start:0x545c18
@debug=1,
@locales="en_US",
@mechanisms="PLAIN AMQPLAIN",
require 'resolv'
def ips_for(host)
Resolv::DNS.open do |dns|
ress = dns.getresources(host, Resolv::DNS::Resource::IN::A)
ress.map { |r| r.address.to_s }
end
end
puts ips_for('heroku.com').sort.first