Skip to content

Instantly share code, notes, and snippets.

View cararemixed's full-sized avatar
🏳️‍🌈

Cara Mitchell cararemixed

🏳️‍🌈
View GitHub Profile
@cararemixed
cararemixed / jruby-error.txt
Created February 1, 2011 18:45
console log
zero:~ brian$ rvm install jruby
jruby-1.5.6 - #fetching
jruby-1.5.6 - #downloading jruby-bin-1.5.6, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10.9M 100 10.9M 0 0 270k 0 0:00:41 0:00:41 --:--:-- 342k
jruby-1.5.6 - #extracting jruby-bin-1.5.6 to /Users/brian/.rvm/src/jruby-1.5.6
jruby-1.5.6 - #extracted to /Users/brian/.rvm/src/jruby-1.5.6
Building Nailgun
jruby-1.5.6 - #installing to /Users/brian/.rvm/rubies/jruby-1.5.6
@cararemixed
cararemixed / hilbert.txt
Created February 21, 2011 20:12
space filling curves generated in Ruby
@@@@@@ @@@@@@ @@@@@@ @@@@@@ @@@@@@ @@@@@@ @@@@@@ @@@@@@
@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
@@ @@@@@@ @@ @@ @@@@@@ @@ @@ @@@@@@ @@ @@ @@@@@@ @@
@@ @@ @@ @@ @@ @@ @@ @@
@@@@@@ @@@@@@ @@@@@@ @@@@@@ @@@@@@ @@@@@@ @@@@@@ @@@@@@
@@ @@ @@ @@ @@ @@ @@ @@
@@@@@@ @@@@@@@@@@@@@@ @@@@@@ @@@@@@ @@@@@@@@@@@@@@ @@@@@@
@@ @@ @@ @@
@@ @@@@@@@@@@ @@@@@@@@@@ @@ @@ @@@@@@@@@@ @@@@@@@@@@ @@
@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
@cararemixed
cararemixed / multi.redis
Created March 17, 2011 23:09
Just some ideas for making Redis MULTI/EXEC much more powerful
WATCH key Watch should still work
[regular ops] ...
MULTI Multi call to create more interesting operations
SADD foo bar Basic mutation. No interesting result.
SMEMBERS foo Pulls members of the set... usually returned to client but not here
SORT @2 DESC LIMIT 10 GET qux_* GET # Does a sort on the 2nd multi command's result
COPY @3 stuff Copy one key to another. One way to save multi results directly
EXEC @3 Executes but only returns 3rd bulk result
li237-51 couchdb # /usr/sbin/ab2 -n 100 -c 1 -k "http://127.0.0.1:5984/bench/_all_docs?limit=50"
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)...
Test aborted after 10 failures
Total of 12 requests completed
brian@li237-51 ~ $ cat /proc/23964/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 16156 16156 processes
Max open files 4096 4096 files
@cararemixed
cararemixed / em.rb
Created April 1, 2011 18:52
This will crash with ulimit -n 4096
require 'rubygems'
require 'em-http-request'
EventMachine.run do
multi = EventMachine::MultiRequest.new
4000.times do
# talking to couchdb in this case but it could be anything else.
multi.add(EventMachine::HttpRequest.new("http://127.0.0.1:5984/").get)
end
multi.callback do
zero:jruby brian$ bin/jruby
Error: dl failure on line 732
Error: failed /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre/lib/client/libjvm.dylib, because dlopen(/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre/lib/client/libjvm.dylib, 10): no suitable image found. Did find:
/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre/lib/client/libjvm.dylib: mach-o, but wrong architecture
@cararemixed
cararemixed / gist:969042
Created May 12, 2011 17:44
jruby-segfault
one:contacts brian$ bundle install
Fetching https://github.com/rails/rails.git
Fetching https://github.com/rack/rack.git
Fetching source index for http://rubygems.org/
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00000001140785a2, pid=12906, tid=4712787968
#
# JRE version: 7.0
one:contacts brian$ bundle install
Fetching source index for http://rubygems.org/
UndefinedMethod.java:59:in `call': java.lang.UnsupportedOperationException: BUG: invoking UndefinedMethod.call; report at http://bugs.jruby.org
from DynamicMethod.java:205:in `call'
from DynamicMethod.java:201:in `call'
from InvokeDynamicSupport.java:717:in `fail'
from /Users/brian/.rvm/gems/jruby-head@contacts/gems/bundler-1.0.13/lib/bundler/spec_set.rb:128:in `__file__'
from /Users/brian/.rvm/gems/jruby-head@contacts/gems/bundler-1.0.13/lib/bundler/spec_set.rb:-1:in `__file__'
from JittedMethod.java:187:in `call'
from FilterGeneric.java:936:in `invoke_F8'
@cararemixed
cararemixed / example.rb
Created May 13, 2011 17:54
Better routes
uri 'contacts', name: 'contacts' do
get 'contacts#index'
end
uri 'contacts/:id/addresses', name: 'contact_addresses' do
put 'contact_addresses#replace'
post 'contact_addresses#create'
delete 'contact_addresses#delete'
end