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 |
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
# Set Hadoop-specific environment variables here. | |
# The only required environment variable is JAVA_HOME. All others are | |
# optional. When running a distributed configuration it is best to | |
# set JAVA_HOME in this file, so that it is correctly defined on | |
# remote nodes. | |
# The java implementation to use. Required. | |
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home |
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 | |
# | |
# The jaql command script (derived from bin/hadoop) | |
# | |
# Environment Variables | |
# | |
# JAVA_HOME The java implementation to use. Overrides JAVA_HOME. | |
# | |
# HADOOP_CLASSPATH Extra Java CLASSPATH entries. | |
# |
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
~/cmdb (git: master) 1.8.7 → ruby -rubygems -S merb | |
Loading init file from /home/konstantin/cmdb/config/init.rb | |
Loading /home/konstantin/cmdb/config/environments/development.rb | |
~ | |
~ FATAL: The gem dm-core (= 0.9.11, runtime), [] was not found | |
~ | |
~/cmdb (git: master) 1.8.7 → gem list --local | grep dm-core | |
dm-core (0.9.11) | |
~/cmdb (git: master) 1.8.7 → irb | |
>> gem "dm-core", "= 0.9.11" |
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'$DONALD_DUCK = /(D)(O).(N).(A)(L)?(D)? *(Duck)?/i; eval([21332, 17487, 21844, 0].pack("n*"))<<(((_=%%mail%)&&%%\%s%%%+\%s+.send(42.chr,(0xe0e000/0x0e0eee)-0b11)%((%w%s On tanT K%.sort<<%%in.%<<_+%+i+<<"\346v\306\2267G7\004v\366\366v\306V".unpack("h*").pack("H*")<<_)+[%.\..]*1+([proc{(ARGV<<:M<<:"O").reverse!;"c"}[]])+ARGV)).send("".methods.grep($DONALD_DUCK)[0]))<<"\n"' -- "my mail address" |
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 "like_smalltalk" | |
=> true | |
>> a = LikeSmalltalk.new 10 | |
=> 10 | |
>> b = a | |
=> 10 | |
>> b.become 11 | |
=> 11 | |
>> b | |
=> 11 |