Skip to content

Instantly share code, notes, and snippets.

View kovacshuni's full-sized avatar

Hunor Kovács kovacshuni

View GitHub Profile
@kovacshuni
kovacshuni / generate-uuid.rb
Created July 22, 2013 08:45
Generating UUID
require "active_support"
p SecureRandom.uuid
@kovacshuni
kovacshuni / ft-video-monitoring.rb
Created July 22, 2013 08:13
Sanity check of video.ft.com
require 'net/http'
def fetch(uri_str, limit = 10)
raise ArgumentError, 'too many HTTP redirects' if limit == 0
response = Net::HTTP.get_response(URI(uri_str))
case response
when Net::HTTPSuccess then
response.body()[/<span class="video\-length">\s*(\d+:\d+ min)\s*<\/span>/]
when Net::HTTPRedirection then
location = response['location']
@kovacshuni
kovacshuni / something
Last active December 19, 2015 10:19
Some modification.
bool Demarc::has(Port p) const throw() {
Mutex::Lock _l(_ports_m);
return (_ports.count(p));
}
@kovacshuni
kovacshuni / lol
Created November 20, 2012 15:53
lol
#define true false //happy debugging motherfuckers :))))