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'); | |
var parameters = process.argv.slice(2, process.argv.length); | |
var timeOut = 2000; | |
console.log(parameters) | |
if(parameters.length == 1 && parameters[0] == "help"){ | |
printHelp(); | |
} | |
if(parameters.length != 2){ |
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'); | |
var server = net.createServer(function(socket){ | |
socket.on('data', function(data){ | |
console.log('data received', data.toString()); | |
socket.write(data, function(){ | |
console.log("data re-sended"); | |
}) | |
}); | |
}).listen(9090); |
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'); | |
var client = new net.Socket(); | |
client.connect(9090, "127.0.0.1", function(){ | |
console.log("connected"); | |
}); | |
var times = 5; | |
var interval = setInterval(function(){ | |
if(!times){ |
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 readline = require('readline'); | |
var net = require('net'); | |
var port = process.env.CHATPORT || 8090; | |
var client = new net.Socket(); | |
client.connect(port, '127.0.0.1', function() { | |
console.log('Connected'); | |
}); | |
client.setEncoding("utf8"); |
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 url = require('url'); | |
var urlAPI = "http://jsonplaceholder.typicode.com/comments"; | |
var urlParts = url.parse(urlAPI); | |
var options = { | |
protocol: urlParts.protocol, | |
hostname: urlParts.host, | |
port: urlParts.port || 80, |
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 express = require('express'); | |
var app = express(); | |
var bodyParser = require('body-parser'); | |
var uuid = require('uuid'); | |
var students = []; | |
// parse application/json | |
app.use(bodyParser.json()); |
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
"use strict" | |
var path = "C:/" | |
var file = "custom.txt"; | |
var filePath = "C:/default.txt" | |
if(file){ | |
filepath = path + file; | |
} | |
console.log(filePath); |
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'); | |
var socket = new net.Socket(); | |
var port = 5000; | |
var host = "127.0.0.1"; | |
var readline = require('readline'); | |
var rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}); |
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'); | |
var socket = new net.Socket(); | |
socket.connect(5000, "127.0.0.1"); | |
var fs = require('fs'); | |
var path = require('path'); | |
var packets = 0; | |
var buffer = new Buffer(0); | |
socket.on('data', function(chunk){ | |
packets++; |
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
//https://scotch.io/tutorials/easy-node-authentication-setup-and-local | |
class PassportConfiguration { | |
constructor(passport) { | |
var LocalStrategy = require('passport-local').Strategy; | |
var FacebookStrategy = require('passport-facebook').Strategy; | |
var UserDA = require('../data').UserDA; | |
var config = require('./config.json'); | |
passport.serializeUser((user, done) => { | |
done(null, user.id); |
OlderNewer