Skip to content

Instantly share code, notes, and snippets.

@jinroh
jinroh / gist:1919161
Last active October 1, 2015 04:28
Markit!
#!/usr/bin/env ruby
require 'rubygems'
require 'redcarpet'
require 'albino'
class SyntaxRenderer < Redcarpet::Render::HTML
def initialize(options)
super options
@style = options[:style]
@jinroh
jinroh / gist:1555907
Last active September 29, 2015 05:57
Kademlia Iterative Find (v1)
# in this algorithm, all notions of *sorting*, *close* or *distance*
# are relative to the XOR distance with the target ID
# as defined in the Kademlia spec
- iterative find (target ID) ->
# INITIALIZATIONS
HeardOf <- XOR Sorted Array of peers
initialized with the 50 (or less) closest peers we know from the our routing table
Reached <- XOR Sorted Array of peers
Queried <- Array of peers