Created
February 29, 2012 09:52
-
-
Save kevinlebrun/64273d5a67da4f8bcf78 to your computer and use it in GitHub Desktop.
Node telnet and local REPL
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
#!/usr/bin/env node | |
var net = require('net'), | |
repl = require('repl'); | |
var mood = function () { | |
var m = [ "^__^", "-___-;", ">.<", "<_>" ]; | |
return m[Math.floor(Math.random() * m.length)]; | |
}; | |
net.createServer(function (socket) { | |
var remote = repl.start('node::remote> ', socket); | |
remote.context.mood = mood; | |
remote.context.bonus = 'UNLOCKED'; | |
}).listen(5001); | |
console.log('Remote REPL started on port 5001.'); | |
var local = repl.start('node::local> '); | |
local.context.mood = mood; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment