Skip to content

Instantly share code, notes, and snippets.

View sbeckeriv's full-sized avatar
🐢
Horray another status box

Stephen Becker IV sbeckeriv

🐢
Horray another status box
  • Death By Escalator
  • Seattle
View GitHub Profile
"person" => {
"date_formats" => ["yyyy-MM-dd", "dd-MM-yyyy"],
"_all" => {"enabled" => true},
"properties" => {
"_id" => {"index"=> "not_analyzed", "store" => "yes",:type=>'integer'},
"username" => {"type" => "string", "store" => "yes"},
"name" => {"type" => "string", "store" => "yes"},
"location" => {
@sbeckeriv
sbeckeriv / gist:998398
Created May 30, 2011 03:01
parise filtered
Parse Failure [No parser for element [filtered]]
{
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "200km",
@sbeckeriv
sbeckeriv / gist:1131225
Created August 8, 2011 04:53
Exact matching
Using ES 17.4
I want to get the exact match for matt. I am seeing matt-, matt, matt-cat...
curl -Xget 'http://localhost:9200/g/_search?pretty=true' -d '{"query":{"term": { "username": "matt"}}}'
the mapping # Im using Tire for ruby. I dont know the mapping syntax.
{
"g" : {
"document" : {
@sbeckeriv
sbeckeriv / gist:1180213
Created August 30, 2011 04:53
query problem
Mapping:
{
"seattlefood" : {
"inspection" : {
"properties" : {
"phone" : {
"type" : "string"
},
"location" : {
"type" : "geo_point"
@sbeckeriv
sbeckeriv / gist:1230713
Created September 20, 2011 23:16
One bus away ruby code
ruby -e "eval ARGV[0].unpack('m').first" "cmVxdWlyZSAibmV0L2h0dHAiCnJlcXVpcmUgInBwIgpkZWYgZ2V0X3RhYmxlKHVybHMscm91dGVzKQogIGFycml2YWxzPVtdCiAgdXJscy5lYWNoIGRvIHx1cmx8CiAgICB4ID0gTmV0OjpIVFRQLmdldChVUkkucGFyc2UodXJsKSkKICAgIHguZ3N1YigiXG4iLCIiKS5tYXRjaCgvPHRhYmxlIC4qPz4oLio/KTxcL3RhYmxlPi9pb20pCiAgICB0YWJsZSA9JDEKICAgIHRhYmxlLmdzdWIhKCI8L3RyPiIsIjwvdHI+XG4iKQogICAgYXJyaXZhbHMucHVzaCh0YWJsZS5nc3ViKC88XC8/W14+XSo+LywgIiAiKS5zcGxpdCgiXG4iKS5zZWxlY3R7fHh8IHgubWF0Y2goL15ccyooI3tyb3V0ZXMuam9pbigifCIpfSlFP1xiLyl9KQogIGVuZAogIGFycml2YWxzLmZsYXR0ZW4uc29ydF9ieXt8eHwgKHh4PXguc3BsaXQoIiAiKVsxXSk9PSJOT1ciID8gMCA6IHh4LnRvX2kgfS5qb2luKCJcbiIpCmVuZApiYXNlX3VybCA9ICJodHRwOi8vd3d3Lm9uZWJ1c2F3YXkub3JnL3doZXJlL3RleHQvc3RvcC5hY3Rpb24/aWQ9MV8iCnVybHMgPSBBUkdWWzFdID8gQVJHVlsxXS5zcGxpdCgiLCIpLm1hcHt8c3wgYmFzZV91cmwrc30gOiBbYmFzZV91cmwgKyAiNjE5Il0KYnVzZXM9QVJHVlsyXSA/IEFSR1ZbMl0uc3BsaXQoIiwiKS5tYXAoJjp0b19pKSA6IFsiLioiXQpwdXRzIGdldF90YWJsZSh1cmxzLGJ1c2VzKQoK" "619" "18,17,15"
@sbeckeriv
sbeckeriv / s
Created February 22, 2012 08:05
crow plugin
plugins = []
plugins.push(
description: "Creates an img tag for image urls so you can see the image inline"
text_only: true
match: [[
/http(s)?:\/\/.+/gi,
(captures)->
iframes = ""
for url in captures
try
Dear Becker,
My name is Mr.Morgan Mawuto ,an Attorney at law, and the Personal lawyer to Mr.William A. Becker, He operated a
coded account with the Bank before he died on a motor accident on the 21st of April 2007, along with his wife their
two daughters. you have the same surname with him, I have a business inherited fund transaction of US$10.5Million,
(Ten Million And Five Hundred Thousand United States Dollars) which I need your assistance, please if you are
interested do contact me for more details on my personal email:( mawutomorgan@yahoo.com ),
Looking forward to receive your urgent response.
@sbeckeriv
sbeckeriv / gist:2654391
Created May 10, 2012 16:43
time geeklet
expr `date -j -f "%d/%m/%Y %H:%M:%S" "7/5/2012 09:54:00" "+%s"` - `date "+%s"` | awk '{ if( int( $1/86400 ) < 0 ) printf "@ Amazon for ⟶ %d days, " , int( $1/86400 ) ; if( int( $1/86400 ) < 0 || int( $1%86400/3600 ) < 0 ) printf "%d hours, " , int( $1%86400/3600 ) ; if( int( $1/86400 ) < 0 || int( $1%86400/3600 ) < 0 || int( $1%3600/60 ) < 0) printf "%d minutes, " , int( $1%3600/60 ) ; if( int( $1/86400 ) < 0 || int( $1%86400/3600 ) < 0 || int( $1%3600/60 ) < 0 || $1%60 < 0 ) printf "%d seconds" , $1%60 ; else printf "Hello!" }' | sed -E 's/-/ /' | sed -E 's/-/ /' | sed -E 's/-/ /' | sed -E 's/-/ /'
@sbeckeriv
sbeckeriv / gist:2865478
Created June 3, 2012 23:55
rails 3 ruby 1.9 setup ec2
http://tanin.nanakorn.com/b/92/amazon_ec2_setup_for_ruby_on_rails
sudo yum erase -y ruby rubygems
sudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel sqlite-devel sqlite curl-devel git ruby19-devel
sudo ln -s /usr/bin/ruby1.9 /usr/bin/ruby
sudo ln -s /usr/bin/gem1.9 /usr/bin/gem
sudo yum install -y aws-amitools-ec2
sudo gem install passenger