Skip to content

Instantly share code, notes, and snippets.

J. Whiteman jwhiteman

Block or report user

Report or block jwhiteman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@prio
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, [])
end
def start_link() do
@tstevens
tstevens / SHA1.rb
Created Apr 18, 2011
Implementation of SHA-1 Hash in pure ruby
View SHA1.rb
#http://stackoverflow.com/questions/5940316/left-rotate-through-carry-in-ruby
class Integer
def lotate(n=1)
self << n | self >> (32 - n)
end
end
# FIPS 180-2 -- relevant section #'s below
# Pulls parts from Wiki pseudocode and http://ruby.janlelis.de/17-sha-256
class SHA1
You can’t perform that action at this time.