Skip to content

Instantly share code, notes, and snippets.

@tizzo
Created September 16, 2011 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tizzo/1223169 to your computer and use it in GitHub Desktop.
Save tizzo/1223169 to your computer and use it in GitHub Desktop.
A service to take a nap
var http = require('http');
var exec = require("child_process").exec;
http.createServer(function (req, res) {
var duration = req.url.substr(1);
exec("sleep " + duration, function (error, stdout, stderr) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('I have slept for ' + duration + ' seconds!\n');
});
).listen(1337, "192.168.56.136");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment