This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby -e "loop { print '>> '; puts('=> ' + eval(gets).inspect) }" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CRuby 1.8.7 >> Switch.first | |
CRuby 1.8.7 => #<Switch ip_address=#<IPAddr: IPv4:192.168.1.240/255.255.255.255> name=nil> | |
CRuby 1.8.7 >> Port.first | |
CRuby 1.8.7 => #<Port trunk=false port_number=1 switch_ip_address=#<IPAddr: IPv4:192.168.1.240/255.255.255.255>> | |
CRuby 1.8.7 >> Switch.first.ports | |
NoMethodError: undefined method `ports_association' for nil:NilClass | |
from /home/konstantin/.config/irb/myirb.rb:108:in `method_missing' | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/associations/relationship.rb:108:in `send' | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/associations/relationship.rb:108:in `get_children' | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/associations/relationship.rb:107:in `each' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Enumerable | |
class Evaluator | |
instance_methods.each { |s| undef_method(s) unless s.to_s =~ /__/ } | |
def initialize(enum, invoke=nil, *args) | |
@enum = enum | |
@invoke = invoke | |
@args = args | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "parse_tree" | |
require "ruby2ruby" | |
module SexpStuff | |
def r2r(a, b = nil) | |
return Ruby2Ruby.new.process a if a.is_a? Sexp | |
r2r u(a, b = nil) | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "cheap_proc" | |
file = "/tmp/stored_proc" | |
unless File.exists? file | |
foo = 42 | |
cheap = lambda { puts foo }.to_cheap_proc | |
File.open(file, "w") { |f| f.write(cheap.dump) } | |
else | |
cheap = File.read(file).to_cheap_proc | |
end |