Skip to content

Instantly share code, notes, and snippets.

View pjanuario's full-sized avatar

Pedro Januário pjanuario

View GitHub Profile
@ldmosquera
ldmosquera / analyze.rb
Last active December 20, 2015 14:19
Analyze Redis and produce CSV with stats, summarizing by "pattern" (foo:bar:123, foo:bar:234, etc)
#!/usr/bin/env ruby
#usage: analyze.rb REDIS_PORT
#produces CSV with stats by key pattern
#ex: [foo:bar:123, foo:bar:234] -> foo:bar:ID
require 'rubygems'
require 'redis'
REDIS_PORT = (ARGV[0] || 6379).to_i
@asalant
asalant / connectWithRetry.js
Created November 17, 2012 01:24
Retry connecting to mongo if initial connect fails
var mongoose = require('mongoose')
var mongoUrl = "mongodb://localhost:27017/test"
var connectWithRetry = function() {
return mongoose.connect(mongoUrl, function(err) {
if (err) {
console.error('Failed to connect to mongo on startup - retrying in 5 sec', err);
setTimeout(connectWithRetry, 5000);
}
});