Skip to content

Instantly share code, notes, and snippets.

pete higgins phiggins

Block or report user

Report or block phiggins

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
View script output
phiggins@gravytrain ~/test $ ruby test_sequel_threaded.rb
I, [2010-06-02T11:24:07.591001 #7130] INFO -- : (0.000126s) PRAGMA foreign_keys = 1
I, [2010-06-02T11:24:07.609124 #7130] INFO -- : (0.017792s) CREATE TABLE `things` (`id` integer PRIMARY KEY AUTOINCREMENT, `n` integer)
I, [2010-06-02T11:24:07.610116 #7130] INFO -- : (0.000098s) PRAGMA table_info('things')
I, [2010-06-02T11:24:07.611848 #7130] INFO -- : (0.000107s) SELECT sqlite_version() LIMIT 1
I, [2010-06-02T11:24:07.614920 #7130] INFO -- : (0.000074s) BEGIN
I, [2010-06-02T11:24:07.615516 #7130] INFO -- : (0.000286s) INSERT INTO `things` (`n`) VALUES (0)
I, [2010-06-02T11:24:07.620080 #7130] INFO -- : (0.000095s) SELECT * FROM `things` WHERE (`id` = 1) LIMIT 1
I, [2010-06-02T11:24:07.648590 #7130] INFO -- : (0.028211s) COMMIT
I, [2010-06-02T11:24:07.649250 #7130] INFO -- : (0.000077s) BEGIN
View simple_udp_p2p_example.rb
require 'eventmachine'
class MyP2PConnection < EM::Connection
def initialize(system)
@system = system
def receive_data(packet)
object = parse(packet)
port, ip = Socket.unpack_sockaddr_in(get_peername)
View ruby_1.9.1-p378_1.9.1-p429.diff
> Fri Jul 2 19:07:09 2010 Yuki Sonoda (Yugui) <>
> * io.c (argf_inplace_mode_set): prohibits an assignment
> of a tainted value. Patch by unak.
> * util.c, file.c: prevents a buffer over-run on windows.
> Patch by unak.
> Wed May 26 13:27:18 2010 Yuki Sonoda (Yugui) <>
View rmu_markdown.rb

Jul 07, 14:01:23  seacreature: I will be starting in 2 minutes, but please say hi now and mention your city :)

Jul 07, 14:01:24  locks: or we'd have the sessions up and running

Jul 07, 14:01:29  chrisdinn: JOINED

Jul 07, 14:01:56  locks: hello, I'm ricardo from Porto, Portugal

Jul 07, 14:02:03  chastell: hi, this is Piotr from Warsaw, Poland

View w 1.9.2-rc1 windows compile error
C:\Documents and Settings\Administrator>gem install eventmachine
Building native extensions. This could take a while...
ERROR: Error installing eventmachine:
ERROR: Failed to build gem native extension.
C:/ruby/192-rc1/bin/ruby.exe extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
View gem install nokogiri -V
$ gem install nokogiri -V
301 Moved Permanently
302 Found
200 OK
200 OK
Installing gem nokogiri-
View em_300_gets.rb
require 'eventmachine'
require 'em-http'
c = 4
urls = {|s| s.strip }
pending = urls.size
before =
puts "urls: #{pending}"
puts "concurrency: #{c}"
View gist:510289
(04:12:04 AM) fd0: is there an example on how to write to a logfile with eventmachine?
(04:12:21 AM) fd0: or should i use default ruby (eventually blocking) io?
(04:12:44 AM) raggi: asynchronous writes to disk are kinda complicated due to platform issues
(04:12:52 AM) raggi: so at the moment, we don't really support it
(04:12:56 AM) raggi: you can use a few tricks though
(04:12:59 AM) fd0: namely?
(04:13:12 AM) raggi: e.g. EM.popen(cat - >> logfile)
View gist:512596
class Inspect
def self.profile
require 'ruby-prof'
result = yield
prof_result = RubyProf.stop
printer =
View em_put_test.rb
require 'em-http'
N = 10
files = (0...N).map do |n|
file = "test_file_#{n}" file, "w" ) do |f|
100_000.times { f << "0123456789" }
You can’t perform that action at this time.