Created
April 1, 2014 20:55
-
-
Save mashiro/9923001 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 'socket' | |
Thread.new do | |
__server = TCPServer.new 12000 | |
loop do | |
Thread.new __server.accept do |__client| | |
__binding = binding | |
loop do | |
__client.print '$ ' | |
cmd = __client.gets | |
break unless cmd | |
result = begin | |
__binding.eval(cmd).inspect | |
rescue => e | |
e | |
end | |
__client.puts "=> #{result}" | |
end | |
__client.close | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment