Skip to content

Instantly share code, notes, and snippets.

@mashiro
Created April 1, 2014 20:55
Show Gist options
  • Save mashiro/9923001 to your computer and use it in GitHub Desktop.
Save mashiro/9923001 to your computer and use it in GitHub Desktop.
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