Skip to content

Instantly share code, notes, and snippets.

@sreeix
sreeix / redis_proxy.js
Created February 23, 2012 11:47
Fake Redis in test
var testy = require('../testy')
var RedisProxy = require('../../lib/redis_proxy')
describe('RedisProxy', function() {
it('raises exception when no rediss available', function() {
(function(){
new RedisProxy({})
}).should.throw();
});
@sreeix
sreeix / pipelined.rb
Created March 28, 2012 12:55
Redis Pipelined
r = Redis.new
Benchmark.bmbm do |b|
b.report("With pipelined") do
r.pipelined { 100000.times{|i| r.set("test#{i}", i)} }
end
b.report("With pipelined inside") do
100000.times{|i| r.pipelined {r.set( "test#{i}", i)} }
end
b.report("No pipeline") do
@sreeix
sreeix / Rakefile
Created June 4, 2012 09:58
Add ability to not load RAILS Stack for rake tasks
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require 'rake'
def with_rails
require File.expand_path('../config/application', __FILE__)
Sf::Application.send :include, Rake::DSL
Sf::Application.load_tasks
end
def without_rails
@sreeix
sreeix / .gitconfig
Created June 14, 2012 07:31
My Git config
[user]
email = sreeix@gmail.com
name = V Sreekanth
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = auto
@sreeix
sreeix / .gitconfig
Created October 10, 2012 10:14
My .gitconfig
[user]
email = sreeix@gmail.com
name = V Sreekanth
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = auto
http://talus.artsci.wustl.edu/MalletAndPythonSteps.html
@sreeix
sreeix / Coding Assignment.markdown
Last active December 13, 2015 21:48
Coding Assignment

I am sure you have heard about memcached. It is a classic key value store. Maintaining a O(1) execution time for most operations.

What We'd like you to implement is memcached in ruby(or the language of your choice)

I normally start memcached this memcached -m 1280 -vv (Actually I use -t 6, but ignore it for now)

Where -m is the amount of memory to allocate and -vv is the verbosity of the logs.