Skip to content

Instantly share code, notes, and snippets.

prio / server.ex
Created Jan 6, 2014
Elixir gen_server example
View server.ex
defmodule Tcprpc.Server do
use GenServer.Behaviour
defrecord State, port: nil, lsock: nil, request_count: 0
def start_link(port) do
:gen_server.start_link({ :local, :tcprcp }, __MODULE__, port, [])
def start_link() do
tstevens / SHA1.rb
Created Apr 18, 2011
Implementation of SHA-1 Hash in pure ruby
View SHA1.rb
class Integer
def lotate(n=1)
self << n | self >> (32 - n)
# FIPS 180-2 -- relevant section #'s below
# Pulls parts from Wiki pseudocode and
class SHA1