Skip to content

Instantly share code, notes, and snippets.

class Memcached::MultiPartRailsCache
MAX_KEY_LENGTH = 255 # Actually overshooting what the client will let you send through
# but this means our chunk sizes will just a few bytes of headroom
# as we split
PART_SIZE = 1.megabyte - MAX_KEY_LENGTH
def initialize(rails_cache)
@rails_cache = rails_cache
end
/**
* A simple preforking echo server in C.
*
* Building:
*
* $ gcc -Wall -o echo echo.c
*
* Usage:
*
* $ ./echo
"""
Simple preforking echo server in Python.
Python port of http://tomayko.com/writings/unicorn-is-unix.
"""
import os
import sys
import socket
@jasonwatkinspdx
jasonwatkinspdx / stats.rb
Created September 15, 2009 20:28 — forked from mojombo/stats.rb
Measurement class
class Measurement
attr_accessor :count, :sum, :sum_squares, :min, :max
def initialize
@count, @sum, @sum_squares, @min, @max = 0, 0, 0, nil, nil
end
def record n
@count += 1
@sum += n