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
-----BEGIN RSA PUBLIC KEY----- | |
MIIBCgKCAQEAvlaG3xvlRyrdeL3QDXE7F514jx87ed5kh80BLoOntY2qESvM/2iT | |
NDCmmWqPvloIogdBRRmeU6UcdOKmbXyMcTzk0d5Aj1LagKeZsC8J+eWD4Hbw0lMU | |
w17WlwATmgQnpuh1Yb+FKwg8sM4SVZSUjMfkiLfob7yiofQnhkMrMj/f3OQl8eVs | |
f0ciDvLGFLdPJ5omwM6MfAcwyNAtUAW3hRwCgTYhbSqzA+cOYyjV3GmgojRvwfy2 | |
H84L2c/IBSOwe3ZtyADTw7NVx29GQqFhVD6SnWFnfoOpOxddfM5qtgId+1+w7/+n | |
DZjzMzBwyfXSiTd3uh2Dwnyz3FevWZH4ywIDAQAB | |
-----END RSA PUBLIC KEY----- |
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
/* | |
* This is a simple program to run Node.js as the | |
* specified user and in a chroot. | |
* | |
* BUILD: | |
* gcc -o chrooted-node chrooted-node.c | |
* | |
* USE: | |
* sudo chrooted-node <as-user> <chroot-dir> <file.js> | |
* |
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
/** | |
* Tries to create the directories of the given path | |
* if they do not exist already. | |
*/ | |
this.mkpath = function(path, mode) { | |
var parts = path.split('/'); | |
if (!parts || parts.length == 0) | |
return; | |
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
// Process files in optimally-sized chunks without | |
// reading the entire file into memory. | |
var posix = require("posix"); | |
this.FileOpenError = function (path, message) { | |
this.message = message || "failed to open file"; | |
this.path = path; | |
}; |
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
GLOBAL.import_package = function(name) { | |
var package = {}; | |
require("posix").readdir(name).wait() | |
.filter(function (filename) { | |
return filename.match(/^(.+)\.js$/); | |
}) | |
.forEach(function (filename) { | |
var basename = filename.split(/^(.+)\.js$/)[1]; | |
package[basename] = require("./" + name + "/" + basename); | |
}); |
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
/** | |
* A PromiseChain calls multiple functions in the same order added, and | |
* expects each function to return a Promise. The next function or link in | |
* the chain is invoked only when the previous promise emits success. The next | |
* function is passed the result of the previous function emits on success. | |
* | |
* A PromiseChain itself has a Promise to track overall success/failure of the | |
* chain. If all functions in the chain emit success, the chain's Promise emits | |
* success in turn, passing the value emitted by the last link/function of the | |
* chain. |
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 promise_chain = require("../promise_chain"), | |
test = require("mjsunit"), | |
sys = require("sys"); | |
function test_single_chain() { | |
callback_called = false; | |
var chain = new promise_chain.PromiseChain(); | |
var link_0_promise = new process.Promise(); |
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
/** | |
* A PromiseGroup accepts a number of named promises, waits for each to | |
* complete (succeed, fail, timeout, cancel), then emits an event to signify | |
* that all accepted promises have completed. | |
* | |
* Names of promises are arbitrary but must be strings and must be unique | |
* across the set of all named promises a PromiseGroup accepts. | |
* | |
* When an individual promise completes, a PromiseGroup emits "one_done" | |
* passing the name of the promise, the outcome ('ok', 'fail', 'cancel', or |
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 promise_group = require("../promise_group"), | |
test = require("mjsunit"), | |
sys = require("sys"); | |
var group = new promise_group.PromiseGroup(); | |
test.assertTrue(group instanceof promise_group.PromiseGroup); | |
function test_single_pass() { |
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
node> p=require('posix'); | |
{ | |
"Stats": [Function], | |
"close": [Function], | |
"closeSync": [Function], | |
"open": [Function], | |
"openSync": [Function], | |
"read": [Function], | |
"readSync": [Function], | |
"write": [Function], |
OlderNewer