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 | |
### BEGIN INIT INFO | |
# Provides: sweepyd | |
# Short-Description: Example initscript | |
# Description: This file should be used to construct scripts to be | |
# placed in /etc/init.d. | |
### END INIT INFO | |
# Author: Pedro Teixeira(http://metaduck.com) |
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
[ENVIRONMENT]: | |
servers: | |
broadcast: | |
bind_address: # the IP address for the server receiving UDP broadcasts. Default is 255.255.255.255 | |
port: # the UDP port for receiving broadcasts. Default is 10000 | |
public: | |
bind_address: #the IP address for the server receiving UDP commands specific to this host. Default is 0.0.0.0 (all interfaces) | |
port: # the UDP port for receiving direct commands. Default is 10001 | |
private: | |
port: # the UDP port for receiving private commands. Default is 10002 |
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
var sys = require( 'sys' ); | |
var http = require('http'); | |
var form_doc = '\ | |
<html> \ | |
<body>\ | |
<form method="POST" action="/body">\ | |
<input type="submit" name="test" value="Body" />\ | |
</form>\ | |
<form method="POST" action="/nobody">\ |
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
var http = require('http'); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('Hello World\n'); | |
}).listen(8124, "127.0.0.1"); | |
console.log('Server running at http://127.0.0.1:8124/'); |
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
var net = require('net'); | |
net.createServer(function (socket) { | |
socket.setEncoding("utf8"); | |
socket.write("Echo server\r\n"); | |
socket.on("data", function (data) { | |
socket.write(data); | |
}); | |
socket.on("end", function () { | |
socket.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
fs.readFile('/etc/passwd', function (err, data) { | |
if (err) throw err; | |
console.log(data); | |
}); |
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
var http = require('http'); | |
var fs = require('fs'); | |
var sys = require('sys'); | |
var filename = 'test.mov'; | |
var content_type = 'video/quicktime'; | |
http.createServer(function (request, response) { | |
response.writeHead(200, { | |
'Content-Type': content_type |
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
var filename = "log.txt"; | |
(function(filename) { | |
fs.open(filename, 'r', 0666, function(err, fd) { | |
sys.log('opened file '+filename); | |
}); | |
})(filename); | |
filename = "/etc/passwd"; |
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
var Step = require('step'); | |
Step( | |
function readSelf() { | |
fs.readFile(__filename, this); | |
}, | |
function capitalize(err, text) { | |
if (err) { | |
throw err; | |
} |
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
fs.open('/etc/passwd', 'r', 0666, function(err, fd) { | |
http = require('http'); | |
http.createClient(80, 'www.myserver.net'); | |
// ... | |
}); |
OlderNewer