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
_sshm() | |
{ | |
local cur prev opts | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
ADD_OPTS=$(sshm --complete) | |
opts="--help --version --add --list --del --show --complete $ADD_OPTS" | |
if [[ ${cur} == * ]] ; then |
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
// Example code for node-abbrev | |
var abbrevlib = require("node-abbrev"); | |
var sys = require("sys"); | |
// valid run modes for the imaginary tool | |
var validModes = ["help", "start", "stop", "status"]; | |
// create Abbreviate instance for the modes | |
// second parameter (case sensitivity) optional, defaults to false | |
var abbrev = new abbrevlib.Abbreviate(validModes); |
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
/* | |
* eventpassing.js | |
* | |
* Monkey patch for passing events between EventEmitters | |
* Usage: simply require() this module | |
* | |
* @author Frank Grimm (http://frankgrimm.net) | |
* @version 0.1.3 | |
* | |
*/ |
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
test-client-connect.js test-client-query.js | |
[root@speicher node-mysql]# node test/system/test-client-connect.js | |
{ length: 52 | |
, received: 52 | |
, number: 0 | |
, type: 0 | |
, protocolVersion: 10 | |
, serverVersion: '5.0.45' | |
, threadId: 132500 | |
, scrambleBuffer: <Buffer 66 3c 37 3d 6c 2b 2f 47 59 6b 2e 41 3c 48 35 70 56 3f 77 5b> |
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 Script = process.binding('evals').Script; | |
var stdin = process.openStdin(); | |
stdin.setEncoding('utf8'); | |
var scriptCode = ''; | |
stdin.on('data', function (chunk) { | |
scriptCode += chunk; | |
}); | |
stdin.on('end', function () { | |
Script.runInThisContext(scriptCode); |
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
/* | |
* syslog-messages.js | |
* | |
* Encoding and decoding of CentOS syslog messages. | |
* | |
* @version: 0.1.0 | |
* @author Frank Grimm (http://frankgrimm.net) | |
* | |
*/ |
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
/* | |
* syslog-server.js | |
* | |
* @version 0.1.0 | |
* @author Frank Grimm (http://frankgrimm.net) | |
* | |
*/ | |
exports.getServer = function(bind_port, bind_ip, callback) { |
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 printMemoryUsage = function() { | |
var spawn = require('child_process').spawn, | |
getconf = spawn('getconf', ['PAGESIZE']); | |
getconf.stdout.on('data', function (data) { | |
var pageSize = parseInt(data, 10); | |
console.log('Page size: ' + pageSize); | |
var procOutput = spawn('cat', ['/proc/' + process.pid + '/status']); |
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 qs = require('querystring'); | |
var query = "foo[name]=bar&foo[bar]=foobar"; | |
var res = qs.parse(query); | |
console.log(res.foo.foo); | |
console.log(res['foo']['bar']); |
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 querystring = require('querystring'); | |
var utils = require('utils'); | |
http.createServer(function (req, res) { | |
switch(req.url) { | |
case '/': | |
res.writeHead(200, "OK", {'Content-Type': 'text/html'}); | |
res.write('<html><head><title>Example</title></head><body>'); | |
res.write('<form enctype="application/x-www-form-urlencoded" action="/formhandler" method="post">'); |
OlderNewer