Skip to content

Instantly share code, notes, and snippets.

View jasongilman's full-sized avatar

Jason Gilman jasongilman

  • Element 84
View GitHub Profile
@jasongilman
jasongilman / clojure_example.clj
Created September 8, 2012 01:24
Clojure example
(def users [{:first-name "William" :last-name "Hudson"}
{:first-name "Ellen" :last-name "Ripley"}
{:first-name "Dwayne" :last-name "Hicks"}
{:first-name "Carter" :last-name "Burke"}])
(def user {:first-name "William" :last-name "Hudson"})
(get :first-name user)
(:first-name user)
@jasongilman
jasongilman / jruby_long_line_parse.rb
Created August 28, 2012 13:13
Demonstrates a JRuby parsing bug with long lines
list = [{"string0"=>"value0"}, {"string1"=>"value1"}, {"string2"=>"value2"}, {"string3"=>"value3"}, {"string4"=>"value4"}, {"string5"=>"value5"}, {"string6"=>"value6"}, {"string7"=>"value7"}, {"string8"=>"value8"}, {"string9"=>"value9"}, {"string10"=>"value10"}, {"string11"=>"value11"}, {"string12"=>"value12"}, {"string13"=>"value13"}, {"string14"=>"value14"}, {"string15"=>"value15"}, {"string16"=>"value16"}, {"string17"=>"value17"}, {"string18"=>"value18"}, {"string19"=>"value19"}, {"string20"=>"value20"}, {"string21"=>"value21"}, {"string22"=>"value22"}, {"string23"=>"value23"}, {"string24"=>"value24"}, {"string25"=>"value25"}, {"string26"=>"value26"}, {"string27"=>"value27"}, {"string28"=>"value28"}, {"string29"=>"value29"}, {"string30"=>"value30"}, {"string31"=>"value31"}, {"string32"=>"value32"}, {"string33"=>"value33"}, {"string34"=>"value34"}, {"string35"=>"value35"}, {"string36"=>"value36"}, {"string37"=>"value37"}, {"string38"=>"value38"}, {"string39"=>"value39"}, {"string40"=>"value40"}, {"string41"
@jasongilman
jasongilman / Results
Created April 16, 2012 12:42
JRuby Concurrency Bug in ShellLauncher
JRUBY_VERSION: 1.6.7
JRUBY_OPTS: --1.9
Starting to modify env
Sleeping 0
Done sleeping 0
Sleeping 1
Exception in thread "RubyThread-1: jruby_bug.rb:4" java.lang.ArrayIndexOutOfBoundsException: 8495
at org.jruby.util.ShellLauncher.getCurrentEnv(ShellLauncher.java:231)
at org.jruby.util.ShellLauncher.popenShared(ShellLauncher.java:712)
at org.jruby.util.ShellLauncher.popenShared(ShellLauncher.java:689)
@jasongilman
jasongilman / gist:1528898
Created December 28, 2011 17:59
Elastic Search Nested Query Problem
#!/bin/sh
# Create main index
curl -XPUT "http://localhost:9200/main/" -d '
{ "settings" : { "index" : { "number_of_shards" : 3 } } }
'
# Set alpha mapping
curl -XPUT "http://localhost:9200/main/alpha/_mapping" -d '
{"alpha": {
@jasongilman
jasongilman / es_upgrade_issue
Created December 23, 2011 19:24
Reproducing elasticsearch upgrade problem
#!/bin/sh
# Run this on an empty elastic search of 0.17.6
# After running it shutdown elastic and start 0.18.6.
# Then execute this query
# curl -XPOST "http://localhost:9200/echo/dataset/_search" -d '{"query":{"filtered":{"query":{"match_all":{}},"filter":{"and":[{"and":[{"nested":{"path":"minimum_bounding_rectangles","query":{"constant_score":{"filter":{"and":[{"and":[{"range":{"north":{"from":-7.711,"to":90.0}}},{"range":{"south":{"from":-90.0,"to":38.273}}}]},{"or":[{"and":[{"or":[{"range":{"west":{"from":-180.0,"to":-3.164}}},{"range":{"east":{"from":-60.117,"to":180.0}}}]},{"term":{"antimeridian":true}}]},{"and":[{"range":{"west":{"from":-180.0,"to":-3.164}}},{"range":{"east":{"from":-60.117,"to":180.0}}}]}]}]}}}}}]},{"term":{"permitted_group_ids":"guest"}}]}}},"fields":["echo_collection_id"],"sort":["echo_collection_id"],"from":0,"size":2100}'
# Create echo index
curl -XPUT "http://localhost:9200/echo/" -d '
{ "settings" : { "index" : { "number_of_shards" : 3 } } }