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 lua | |
--[[ | |
dsl-print [some.dsl] | |
Example of a lua DSL language, that can use function call or assignment to define | |
keys, and uses call sequence to implicitly define nesting. | |
]] | |
function dsl(code, file) | |
local loaded, estr = loadstring(code, file) |
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
print"TABLE" | |
function directory(path) | |
print("directory", path) | |
return function(attrs) | |
for key,value in pairs(attrs) do | |
print("", key, value) | |
end | |
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
var cluster = require('cluster') | |
, net = require('net'); | |
if (cluster.isMaster) { | |
console.log('master: node version', process.version); | |
var worker = cluster.fork(); | |
worker.on('online', function() { | |
console.log('master: on worker/online'); | |
}); |
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
assert = require('assert') | |
cluster = require('cluster'); | |
if(cluster.isMaster) { | |
worker=cluster.fork(); | |
worker.on('exit', function(code, signal) { | |
console.log('worker on exit', code, signal, 'process.exitCode', worker.process.exitCode) | |
}) | |
worker.on('online', function() { | |
console.log('worker pid', worker.process.pid) | |
worker.kill('SIGTERM') |
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
sam@samtu:~/w/sn/slc (release/2.0.0 *% u=) % npm install -g strong-slc | |
npm http GET https://registry.npmjs.org/strong-slc | |
npm http 304 https://registry.npmjs.org/strong-slc | |
npm http GET https://registry.npmjs.org/strong-slc/-/strong-slc-2.0.0.tgz | |
npm http 404 https://registry.npmjs.org/strong-slc/-/strong-slc-2.0.0.tgz | |
npm ERR! fetch failed https://registry.npmjs.org/strong-slc/-/strong-slc-2.0.0.tgz | |
npm ERR! Error: 404 Not Found | |
npm ERR! at WriteStream.<anonymous> (/usr/local/stow/node/lib/node_modules/npm/lib/utils/fetch.js:57:12) | |
npm ERR! at WriteStream.EventEmitter.emit (events.js:117:20) | |
npm ERR! at fs.js:1596:14 |
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
sam@samtu:~/w/sn/slc (release/2.0.0 % u=) % npm publish | |
npm http PUT https://registry.npmjs.org/strong-slc | |
npm http 201 https://registry.npmjs.org/strong-slc | |
npm http GET https://registry.npmjs.org/strong-slc | |
npm http 200 https://registry.npmjs.org/strong-slc | |
npm http PUT https://registry.npmjs.org/strong-slc/-/strong-slc-2.0.0.tgz/-rev/1-3087bd76554a3769731e0808c6daec05 | |
npm http 201 https://registry.npmjs.org/strong-slc/-/strong-slc-2.0.0.tgz/-rev/1-3087bd76554a3769731e0808c6daec05 | |
npm http PUT https://registry.npmjs.org/strong-slc/2.0.0/-tag/latest | |
npm http 201 https://registry.npmjs.org/strong-slc/2.0.0/-tag/latest | |
+ [email protected] |
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 cluster = require('cluster') | |
var net = require('net'); | |
var spawn = require('child_process').spawn; | |
if(cluster.isMaster) { | |
cluster.fork() | |
cluster.on('exit', function() { | |
//cluster.disconnect(); // if .disconnect() is called, it closes the serverHandlers |
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
assert = require('assert') | |
cluster = require('cluster'); | |
if(cluster.isMaster) { | |
worker=cluster.fork(); | |
worker.on('online', function() { | |
// pause, to give worker time to establish signal handler | |
setTimeout(function() { | |
worker.process.kill('SIGTERM') | |
}, 100); | |
}); |
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 cluster = require('cluster'); | |
if(cluster.isMaster) { | |
cluster.fork() | |
.on('online', function() { | |
this.disconnect(); | |
}); | |
} else { | |
process.on('internalMessage', function(msg) { | |
console.log('internalMsg', msg); |
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 domain = require('domain'); | |
d = domain.create(); | |
d.enter() | |
d.on('error', function(er) { | |
d.exit(); | |
console.log('hmm, er'); | |
process.nextTick(function() { | |
throw er; | |
}); | |
}); |
OlderNewer