Original link: http://www.concentric.net/~Ttwang/tech/inthash.htm
Taken from: http://web.archive.org/web/20071223173210/http://www.concentric.net/~Ttwang/tech/inthash.htm
Reformatted using pandoc
Thomas Wang, Jan 1997
last update Mar 2007
class TicketsController < ApplicationController | |
def show | |
tickets = params[:tickets].split(",") | |
ticket_data = tickets.map do |ticket| | |
parallel { Faraday.get("http://tickets.local/#{ticket}") } | |
end | |
render json: { tickets: ticket_data.map(&:result) } | |
end |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
/* | |
* Cubism source for Papertrail | |
* https://papertrailapp.com/ | |
*/ | |
cubism.context.prototype.papertrail = function(token) { | |
var source = {}; | |
source.metric = function(expression, title) { | |
var lookup = {}; |
class HammingCode | |
attr_reader :data_bits | |
def initialize(number) | |
@number = number | |
@data_bits = number.to_s(2) | |
end | |
def parity_bits | |
indexes = [] | |
current_index = 3 |
This playbook has been removed as it is now very outdated. |
namespace :redis_failover do | |
task :monitor_client do | |
require 'redis_failover' | |
zookeepers = ENV['ZOOKEEPERS'] | |
if !zookeepers && zookeepers_file = ENV['ZOOKEEPERS_FILE'] | |
if File.exists?(zookeepers_file) | |
zookeepers = File.read(zookeepers_file).chomp | |
end |
export t=$(date +%s) | |
lockfile $t #create lock. Try running `lockfile $t` in another shell. | |
rm -f $t #delete lock |
Original link: http://www.concentric.net/~Ttwang/tech/inthash.htm
Taken from: http://web.archive.org/web/20071223173210/http://www.concentric.net/~Ttwang/tech/inthash.htm
Reformatted using pandoc
Thomas Wang, Jan 1997
last update Mar 2007
package main | |
import( | |
"log" | |
"net/url" | |
"net/http" | |
"net/http/httputil" | |
) | |
func main() { |