Skip to content

Instantly share code, notes, and snippets.

View sleeptillseven's full-sized avatar
💭
I may be slow to respond.

Christoph Jasinski sleeptillseven

💭
I may be slow to respond.
  • Bern, Switzerland
View GitHub Profile
@mperham
mperham / gist:1379464
Created November 19, 2011 22:33
Flexibility without Dependency Injection
class TaxCode
GENERATORS = {
:us => lambda { |id| "US-#{id}" },
:br => lambda { |id| "#{id + 9}-BRA" },
}
def self.generate(code, id)
gen = GENERATORS[code] || raise ArgumentError, "No generator for country #{code}"
gen.call(id)
end
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@jboner
jboner / latency.txt
Last active June 8, 2024 14:56
Latency Numbers Every Programmer Should Know
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
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 9, 2024 10:41
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@louiszuckerman
louiszuckerman / gfid-resolver.sh
Last active November 29, 2023 10:01
Glusterfs GFID Resolver Turns a GFID into a real path in the brick
#!/bin/bash
if [[ "$#" < "2" || "$#" > "3" ]]; then
cat <<END
Glusterfs GFID resolver -- turns a GFID into a real file path
Usage: $0 <brick-path> <gfid> [-q]
<brick-path> : the path to your glusterfs brick (required)
@ericmoritz
ericmoritz / .gitignore
Last active December 13, 2015 20:08
Java vs Erlang.
*~
*.beam
package main
import (
"fmt"
"runtime"
"time"
)
func waitAround(die chan bool) {
<- die

Description

I decided to hook up the node.js C libuv async IO library that uses IOCP on Windows and epoll/kqueue/event ports/etc. on Unix systems to handle HTTP traffic to test if this is a suitable HTTP front end for Dazzle.

There is no V8 javascript engine so it's not running node.js, only the libuv async IO eventing and some C for handling the HTTP parsing.

Setup

  • libuv is using default settings, zero tuning has been done.
  • Client requests coming from a single remote client machine (Linux) over the LAN.
@postspectacular
postspectacular / problem59.clj
Created May 11, 2013 19:12
Project Euler #59 solution w/ Clojure
(ns toxi.euler.problem59)
;; http://projecteuler.net/problem=59
;; solution by: toxi <k at postspectacular dot com>
;; 2012-12-23
(defn xor-decrypt
"Applies bit-xor to all items in src using key as cyclic sequence."
[src key] (map bit-xor src (cycle key)))