This file contains hidden or 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
// Section 1 | |
var express = require('express'); | |
const bodyParser = require('body-parser'); | |
const { EventEmitter } = require('events'); | |
const morgan = require('morgan'); | |
const app = express(); | |
const profilingEventEmitter = new EventEmitter(); | |
// Section 2 | |
profilingEventEmitter.on('middleware', ({ req, name, elapsedMS }) => { |
This file contains hidden or 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
import java.util.Arrays; | |
import java.util.List; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.ThreadPoolExecutor; | |
import java.io.InputStream; | |
import java.net.URL; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.nio.file.StandardCopyOption; |
This file contains hidden or 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
const request = require('request'); | |
const fs = require('fs'); | |
const async = require('async'); | |
const avatarsNamesArray = ['1.png','2.png','3.png','4.png','5.png','6.png','7.png','8.png','9.png','10.png']; | |
getAndStoreAvatar = function(avatarName, callback) { | |
console.log(avatarName + ' is downloading'); | |
let stream = request | |
.get('https://api.adorable.io/avatars/285/' + avatarName) |
This file contains hidden or 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(); | |
//Serves resources from public folder | |
app.use(express.static('public')); | |
app.listen(3000); |
This file contains hidden or 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
[ | |
{ | |
"ID": 1, | |
"Name": "Tankala Ashok", | |
"IDNumber": "1234" | |
}, | |
{ | |
"ID": 2, | |
"Name": "Himabindu", | |
"IDNumber": "2345" |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
<script> | |
function onLoad() { | |
var url = 'jsonData.json'; | |
$.getJSON(url, function (json) { | |
var table = $('<table>'); |
This file contains hidden or 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
<html> | |
<head> | |
<title>MNIST</title> | |
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"> </script> | |
<script type="text/javascript"> | |
// Variables for referencing the canvas and 2dcanvas context | |
var canvas, ctx; | |
// Variables to keep track of the mouse position and left-button status |
This file contains hidden or 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
//We can use fs.readdir or fs.readdirSync methods | |
const fs = require('fs'); | |
const testFolder = __dirname + '/files/'; | |
//Asynchronous way | |
fs.readdir(testFolder, (err, files) => { | |
files.forEach(file => { | |
console.log(file); | |
}); | |
}) |
This file contains hidden or 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 kafka = require('kafka-node'); | |
var producer = null; | |
var readyFlag = false; | |
var BaseModel = function () { | |
}; | |
BaseModel.prototype.produceJob = function (topic, pload, isBatchProducer, callback) { | |
module.exports.getProducer(topic, pload, isBatchProducer); |
This file contains hidden or 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 kafka = require('kafka-node'); | |
exports.initiateKafkaConsumerGroup = function (groupName, topicName) { | |
var options = { | |
// connect directly to kafka broker (instantiates a KafkaClient) | |
kafkaHost: '127.0.0.1:9092', | |
groupId: groupName, | |
autoCommit: true, | |
autoCommitIntervalMs: 5000, | |
sessionTimeout: 15000, |