Skip to content

Instantly share code, notes, and snippets.

storefront = {
'AL':'143575',
'DZ':'143563',
'AO':'143564',
'AI':'143538',
'AG':'143540',
'AR':'143505',
'AM':'143524',
'AU':'143460',
'AT':'143445',
@teebu
teebu / cors-nginx.conf
Last active August 29, 2015 14:27 — forked from alexjs/cors-nginx.conf
Slightly tighter CORS config for nginx
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#
bin/logstash -e 'input {
stdin {
}
}
filter {
ruby {
code => "event['hello'] = 'world'"
}
}
//console.log(stringDateToEpoch("2016-01-31T21:52:02.607Z"))
var obj = { "rank_history": [
{"date": "2016-02-17T04:27:16.773Z","rank": 121},
{"date": "2016-02-15T05:37:16.773Z","rank": 122},
[1455763092,153],
[1455761092,154],
{"date": "2016-02-14T02:27:16.773Z","rank": 125},
[1455781509,156]
]
input {
redis {
host => "xxx.com"
tags => [ "keywords" ]
data_type => "list"
key => "keywords_list"
codec => json
db => 2
}
}
bin/logstash -e '
input {
stdin { }
}
output {
elasticsearch {
hosts=>["localhost"]
index => "testing"
}
stdout {codec => rubydebug }
@teebu
teebu / jruby-amazon-linux.bash
Created March 3, 2016 04:32 — forked from kainam00/jruby-amazon-linux.bash
Install jruby on Amazon Linux
#!/bin/bash
# Install prerequisites
yum install -y gcc openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel ruby-devel gcc-c++ jq git
# Import key
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
# Install RVM
curl -sSL https://get.rvm.io | bash -s stable --ruby
class NilClass
def blank?
true
end
def not_blank?
!blank?
end
end
class String
def blank?
filter {
if [type] == "abc" {
metrics {
meter => "events"
add_tag => "metric"
}
}
@teebu
teebu / testing cloning
Created March 12, 2016 00:59
testing cloning
input {
stdin {
type => "typeA"
}
}
filter {
if [type] == "typeA" {