Skip to content

Instantly share code, notes, and snippets.

View michaelklishin's full-sized avatar

Michael Klishin michaelklishin

View GitHub Profile
@geelen
geelen / haskell.sh
Created September 17, 2013 05:20
Real-world benchmarks
$ time ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
real 0m0.074s
user 0m0.006s
sys 0m0.012s
# run with "jruby --1.9 /path/to/this.rb" and wait 10 minutes
class Thing
def initialize
require 'cabin'
@logger = Cabin::Channel.new
sout = Logger.new(STDOUT)
@logger.level = :debug
@jespada
jespada / haproxy.cfg
Created March 9, 2013 21:03
haproxy(1.5) + ssl + websockets (see comments on how to create a .pem file)
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
timeout connect 5s
timeout client 50s
timeout server 50s
@samuelclay
samuelclay / radix_trie.clj
Created January 22, 2013 17:51
A Radix Trie (aka PATRICIA trie) implemented in Clojure. For my JavaScript implementation, see this interactive JS fiddle: http://jsfiddle.net/jCYAw/
(ns radix
(:require [clojure.string :as string]))
(use 'clojure.java.io)
(use 'clojure.pprint)
(println "Loading names... ")
(time (def names
(with-open
[rdr (reader
"/usr/share/dict/ProperNames")]
@coderoshi
coderoshi / gist:3729593
Last active March 31, 2022 15:43
A Very Short Guide to Writing Guides

A Very Short Guide to Writing Guides

This is just a few thoughts on the topic of writing technical guides. This was intended for Basho's engineering team, but this may apply to open source projects in general.

Audience

It's commonly preached that the first step in writing is to identify your audience; to whom are you writing? This is the most well known, most repeated, and most overlooked step of writing in general and technical writing in particular. Take this document, for example. My audience is technical people who need to communicate technical information, and not teenagers, so I shy away from images of pop icons and memes. I use jargon and words like "identify" rather than "peep this".

Pronouns

//Pinstats.
//Fetch the pinterest front page. Extract all the name elements
//and keep track of the gender of what you find
package main
import (
"code.google.com/p/go-html-transform/html/transform"
"fmt"
@eliaslevy
eliaslevy / gist:3042381
Created July 3, 2012 19:43
High level AMQP blocking publish method
# Helper method that publishes a message to an exchange and waits for a
# broker acknowledgement using RabbitMQ's publisher confirmation extension.
#
# Confirm mode must already be enabled in the channel. You can turn
# confirm mode on using channel.confirm_select. You must only do this
# once.
#
# It also raises an error if you use the mandatory and/or immediate
# options, and these constrains cannot be meet by the broker.
#
@michaelklishin
michaelklishin / latency.txt
Created June 19, 2012 00:13 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
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
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
#!/bin/sh
#
# Downloads and installs the startssl CA certs into the global java keystore
# Author: Klaus Reimer <k@ailis.de>
#
# Check if JAVA_HOME is set
if [ "$JAVA_HOME" = "" ]
then
echo "ERROR: JAVA_HOME must be set."
@guillaumebort
guillaumebort / 1.sql
Created May 25, 2012 15:17
Play 2.0/Anorm
# --- !Ups
CREATE TABLE users(
email VARCHAR(255) NOT NULL PRIMARY KEY,
name VARCHAR(255)
);
CREATE TABLE subjects(
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
title LONGTEXT NOT NULL,