Skip to content

Instantly share code, notes, and snippets.

View telamon's full-sized avatar
🙂
probing for lost signals

Tony Ivanov telamon

🙂
probing for lost signals
View GitHub Profile
@telamon
telamon / rdhcpd.rb
Created May 20, 2011 23:58
Pure ruby DHCP server
' Copyright (c) 2007, Tony Ivanov
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
@telamon
telamon / short_hash.rb
Created May 16, 2011 16:34
Really short(6chars) hash method
# Really short hash, (no extra collisions besides the known CRC32 )
# Correct term for this encoding should be "Trimmed Urlsafe Base Encoded CRC32 Hash" or TUBECH?.. two-bitch encoding, lol.
# String.send(:include , ShortHash)
# "Hello World".short_hash # => "VrEXSg"
module ShortHash
require 'base64'
@telamon
telamon / array_group.rb
Created April 27, 2011 12:55
JS array.inGroupsOf() behaviour for Ruby
class Array
def groups_of(s)
resp = []
g=[]
self.each do |i|
g << i
if g.count == s
resp << g
g= []
end