Skip to content

Instantly share code, notes, and snippets.

View ben-av's full-sized avatar

Ben Aviram ben-av

  • FlyMoney / AI21 Labs
View GitHub Profile
alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("")
base = alphabet.length
exports.encode = (i) ->
return alphabet[0] if i is 0
s = ""
while i > 0
s += alphabet[i % base]
i = parseInt(i / base, 10)
@ben-av
ben-av / es
Created April 30, 2012 11:33
components es
{
"ok" : true,
"_shards" : {
"total" : 10,
"successful" : 10,
"failed" : 0
},
"indices" : {
"components_usages" : {
"shards" : {
@ben-av
ben-av / usage optimized
Created April 30, 2012 12:06
usage optimized gist
{
"ok" : true,
"_shards" : {
"total" : 10,
"successful" : 10,
"failed" : 0
},
"indices" : {
"components_usages" : {
"shards" : {
@ben-av
ben-av / cluster_es
Created May 20, 2012 08:33
Cluster ES
{"cluster_name":"toolbarAnalyticsProd","master_node":"3zmlEF3QTwmROixx81va9w","blocks":{},"nodes":{"mn9lHY_BSRKfxBzB4WKarw":{"name":"Ectokid","transport_address":"inet[/10.28.131.75:9300]","attributes":{}},"6TWnXu-EREmN3xYTnvN8Mg":{"name":"Pixie","transport_address":"inet[/10.28.89.101:9300]","attributes":{}},"FkhJV3H1Sw-VX0KI4uiMvw":{"name":"Moondragon","transport_address":"inet[/10.28.89.99:9300]","attributes":{}},"pIfpHSbhRDqGqbSOst1Oyw":{"name":"Atom Bob","transport_address":"inet[/10.28.89.112:9300]","attributes":{}},"3zmlEF3QTwmROixx81va9w":{"name":"Blowhard","transport_address":"inet[/10.28.89.85:9300]","attributes":{}},"UDgVYC75TSqp8vGeuX41MA":{"name":"Vulcan","transport_address":"inet[/10.28.89.153:9300]","attributes":{}}},"metadata":{"templates":{},"indices":{"key_facts":{"state":"open","settings":{"index.number_of_replicas":"1","index.number_of_shards":"2","index.version.created":"190099","index.search.slowlog.threshold.query.warn":"4s","index.search.slowlog.level":"TRACE","index.routing.allocation
@ben-av
ben-av / gist:3608264
Created September 3, 2012 10:05
Capistrano - deployment email with list of git commits
namespace :release do
desc "get current commit in remote server"
task :before do
begin
remote_sha = capture("cd #{current_path}; git rev-parse --verify HEAD")
set :remote_before_commit, remote_sha.strip
# first time deploy can throw exception
rescue
end
end