Skip to content

Instantly share code, notes, and snippets.

View rkh's full-sized avatar
👀
heeeyyyy

Konstantin Haase rkh

👀
heeeyyyy
View GitHub Profile
>> def foo; bar = "blah"; raise NotImplementedError; end
=> #<CompiledMethod foo file=(irb)>
>> def get_exception; begin; yield; nil; rescue Exception => e; e; end; end
=> #<CompiledMethod get_exception file=(irb)>
>> e = get_exception { foo }
=> #<NotImplementedError: NotImplementedError>
>> cx = e.context
=> #<MethodContext:0x16a main#foo (irb):1>
>> m = cx.method
=> #<CompiledMethod foo file=(irb)>
Ubuntu 8.10, 2.6.27-10-generic #1 SMP Fri Nov 21 12:00:22 UTC 2008 i686 GNU/Linux
rubinius (git: master) $ gdb --args rbx irb -f
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
konstantin:~/Workspace/misc/rubinius-copy (git: master) $ uname --all
Linux localtoast 2.6.27-10-generic #1 SMP Fri Nov 21 12:00:22 UTC 2008 i686 GNU/Linux
konstantin:~/Workspace/misc/rubinius-copy (git: master) $ gdb --args bin/rbx -e "puts ObjectSpace.each_object { }"
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
--- from irb, updated
@rkh
rkh / compare_gems.sh
Created February 4, 2009 12:28
all your gems for ruby 1.9.1
#!/bin/bash
gem1.8 list --local --no-versions > 1.8.txt
gem1.9 list --local --no-versions > 1.9.txt
diff gem1.8.txt gem1.9.txt
@rkh
rkh / alg_earliestdeadlinefirst.c
Created February 4, 2009 18:36
primitive scheduler algorithms
#include "algorithms.h"
#include "dispatcher.h"
HANDLE Algorithm_EarliestDeadlineFirst(PLIST_ENTRY TaskList, ULONG Clock) {
PLIST_ENTRY ListEntry, Candidate;
HANDLE CandidateThreadHandle, ListEntryThreadHandle;
PDISPATCHER_TASK ListEntryTask;
PEDF_TASKINFO ListEntryTaskInfo, CandidateTaskInfo;
@rkh
rkh / repl
Created February 17, 2009 15:35
ruby -e "loop { print '>> '; puts('=> ' + eval(gets).inspect) }"
@rkh
rkh / git-thanks
Created March 5, 2009 12:41 — forked from rares/git-thanks
#!/bin/sh
# Usage: git-thanks <since>..<until>
#
# All commits on master, ever:
# git-thanks master
#
# All commits on master since the 0.9.0 tag:
# git-thanks 0.9.0..master
git log "$1" |
require "rubygems"
require "snmp"
mac = ARGV.shift.dup
unless mac.gsub! /^(..)[-: ]?(..)[-: ]?(..)[-: ]?(..)[-: ]?(..)[-: ]?(..)[-: ]?$/, '\1 \2 \3 \4 \5 \6'
puts "illegal mac"
exit
end
mac = mac.split(" ").collect { |hex| eval("0x#{hex}").to_s }.join "."
require "socket"
require "drb"
uri = ARGV.shift
# Socket overwrites send!
class Wrapper
include DRb::DRbUndumped
def initialize object
@object = object