Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var util = require('util'),
http = require('http'),
argv = require('optimist').argv;
var port = argv.p || argv.port || 8000;
http.createServer(function (req, res) {
console.log(req.method + ' request: ' + req.url);
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('hello, i know nodejitsu.');
res.end();
}).listen(port);
/* server started */
util.puts('> hello world running on port ' + port);
#!/usr/bin/node
/* r2.js irc bot -- author: pancake(nopcode.org) */
/* TODO: use node-daemon and chroot */
var OPT = require ("optimist").argv;
var IRC = require ('irc.js');
var irc;
/* config */
var nick = OPT.nick || "r2bot"
var channel = OPT.channel || "#radare"
var host = OPT.host || "irc.freenode.net"
var port = OPT.port || 6667
var owner = OPT.owner || "pancake";
var file = OPT.file || "/bin/ls"
var limit = OPT.limit || 10;
const msgtimeout = 1000
const Chi = "\x1b[32m"
const Cend = "\x1b[0m"
const print = console.log
function finalize() {
if (irc) irc.privmsg (channel, "byebye");
print ("^C :D");
process.exit (0);
}
if (channel[0] != '#')
channel = '#'+channel;
#!/usr/bin/env node
// Copyright IBM Corp. 2013,2019. All Rights Reserved.
// Node module: strong-docs
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
var Docs = require('../lib/docs').Docs;
var argv = require('optimist').argv;
var path = require('path');
var fs = require('fs-extra');
var debug = require('debug')('strong-docs:cli');
var port = argv.port || process.env.PORT || 3000;
var express = require('express');
var configPaths = {};
var configPath = argv.config || argv.c || 'docs.json';
var config;
var outputPath = argv.out || argv.o;
// --html-file
// The file name for generated html
var htmlFile = argv['html-file'] || 'index.html';
var tsConfig = argv.tsconfig;
var tsTarget = argv.tstarget;
var previewMode = argv.preview || argv.p;
var packagePath = argv.package || 'package.json';
var package;
// --skip-public-assets
// Do not copy `public` assets as it can be shared
};
if (typeof argv.render !== 'undefined') {
settings.type = argv.render;
}
if (typeof argv.to !== 'undefined') {
settings.exportPath = __dirname+argv.to;
}
if (typeof argv.upload !== 'undefined') {
settings.uploadPath = __dirname+argv.upload;
}
if (typeof argv.port !== 'undefined') {
settings.port = argv.port;
}
var app = express();
app.use(bodyParser.json());
app.use(express.static('html'));
app.set('view engine', 'ejs');
app.set('views', './views')
/* Multer upload diskstorage */
var storage = multer.diskStorage({ //multers disk storage settings
destination: function(req, file, cb) {
cb(null, settings.uploadPath)
},
uploadPath: __dirname + '/uploads'
};
if (typeof argv.render !== 'undefined') {
settings.type = argv.render;
}
if (typeof argv.to !== 'undefined') {
settings.exportPath = __dirname+argv.to;
}
if (typeof argv.upload !== 'undefined') {
settings.uploadPath = __dirname+argv.upload;
}
if (typeof argv.port !== 'undefined') {
settings.port = argv.port;
}
var app = express();
app.use(bodyParser.json());
app.use(express.static('html'));
app.set('view engine', 'ejs');
app.set('views', './views')
/* Multer upload diskstorage */
var storage = multer.diskStorage({ //multers disk storage settings
destination: function(req, file, cb) {
cb(null, settings.uploadPath)
opts.host = opts.host || 'localhost'
opts.protocol = opts.protocol || 'http'
var protocol = require(opts.protocol)
var server = protocol.createServer(function (instream, outstream) {
var streams = setup(args)
streams.unshift(es.split())
streams.unshift(instream)
streams.push(outstream || instream)
es.pipe.apply(null, streams)
})
server.listen(opts.port, opts.host)
console.error(process.argv[1] +' is listening for "' + opts.protocol + '" on ' + opts.host + ':' + opts.port)
}
}
var argv = require('optimist').argv;
var path = require('path');
module.exports = {
server: {
distFolder: argv.root || '../dist',
listenPort: argv.port || 1337,
dataFolder: argv.data || 'data',
delay: 500
}
};
var express = require('express'),
app = express(),
http = require("http"),
server = http.createServer(app),
bodyParser = require('body-parser'),
multer = require('multer'),
zero = require('./system/core/zero'),
colors = require('colors'),
argv = require('optimist').argv,
port = argv.port || 3000,
path = require('path'),
compress = require('compression');
app.use(compress());
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
app.use(multer({ dest: './uploads/'}))
app.use( '/uploads', express.static( path.join(__dirname,'./uploads')) )
app.engine('jade', require('jade').__express);
app.engine('html', require('ejs').renderFile);
app.engine('ejs', require('ejs').renderFile);
app.set('views', __dirname )
return;
}
if (!args[0]) return process.stderr.write('\n');
var msg = '\x1b[34mServer:\x1b[m \x1b[31m'
+ util.format.apply(util.format, args)
+ '\x1b[m';
return process.stderr.write(msg + '\n');
}
/**
* Start Server
*/
server.on('request', app);
server.app = app;
server.port = +argv.p || +argv.port || 8080;
if (argv.s) {
server.listen(server.port);
return;
}
if (!module.parent || path.basename(module.parent.filename) === 'index.js') {
server.listen(server.port, function(addr) {
if (!isNode) return;
var customer = require('./customer');
customer.sendPayment(function(err) {
if (err) return error(err.message);
customer.print('Payment sent successfully.');
});
});
} else {