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 gym | |
| env = gym.make('CartPole-v1') | |
| env.reset() | |
| for step_index in range(1000): | |
| env.render() | |
| action = env.action_space.sample() | |
| observation, reward, done, info = env.step(action) | |
| print("Step {}:".format(step_index)) | |
| print("action: {}".format(action)) | |
| print("observation: {}".format(observation)) |
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 cassandra = require('cassandra-driver'); | |
| const client = new cassandra.Client({contactPoints: ['127.0.0.1'], keyspace: 'movie_lens'}); | |
| const bignum = require('bignum'); | |
| //Finding minimum and maximum token range in a Cassandra table | |
| client.execute('select MIN(token(movie_id)), MAX(token(movie_id)) from movies;', | |
| function(err, result) { | |
| let minToken = result.rows[0]['system.min(system.token(movie_id))']; | |
| let maxToken = result.rows[0]['system.max(system.token(movie_id))']; | |
| console.log("Minimum token: " + minToken); |
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 mysql = require('mysql'); | |
| var con = mysql.createConnection({ | |
| host: "localhost", | |
| user: "root", | |
| password: "root", | |
| database: "Employee" | |
| }); | |
| con.connect(function (err) { |
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 mainFunction = function(callback) { | |
| //Did something | |
| console.log("In Main Function"); | |
| callback(); | |
| } | |
| var callbackFunction = function() { | |
| console.log('Variable: ' + this.variable); | |
| console.log("In Callback Function"); | |
| } |
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 mysql = require('mysql'); | |
| var con = mysql.createConnection({ | |
| host: "localhost", | |
| user: "root", | |
| password: "root", | |
| database: "Employee" | |
| }); | |
| con.connect(function (err) { |
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 stopWordsSet = new Set(["a", "about", "above", "after", "again", "against", "all", "am", "an", "and", "any", "are", "as", "at", "be", "because", "been", "before", "being", "below", "between", "both", "but", "by", "could", "did", "do", "does", "doing", "down", "during", "each", "few", "for", "from", "further", "had", "has", "have", "having", "he", "he'd", "he'll", "he's", "her", "here", "here's", "hers", "herself", "him", "himself", "his", "how", "how's", "i", "i'd", "i'll", "i'm", "i've", "if", "in", "into", "is", "it", "it's", "its", "itself", "let's", "me", "more", "most", "my", "myself", "nor", "of", "on", "once", "only", "or", "other", "ought", "our", "ours", "ourselves", "out", "over", "own", "same", "she", "she'd", "she'll", "she's", "should", "so", "some", "such", "than", "that", "that's", "the", "their", "theirs", "them", "themselves", "then", "there", "there's", "these", "they", "they'd", "they'll", "they're", "they've", "this", "those", "through", "to", "too", "under", "until", "up", "very", " |
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
| app.get('/doCPUProfiling/profileId/:profileId/durationInSec/:durationInSec', function (req, res) { | |
| let profileId = req.params['profileId']; | |
| let durationInMilliSec = req.params['durationInSec'] * 1000; | |
| // Start profiling | |
| profiler.startProfiling(profileId); | |
| setTimeout(function () { | |
| stopProfiling(profileId); | |
| }, durationInMilliSec); | |
| res.json({}); | |
| }); |
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 stopWords = ["a", "about", "above", "after", "again", "against", "all", "am", "an", "and", "any", "are", "as", "at", "be", "because", "been", "before", "being", "below", "between", "both", "but", "by", "could", "did", "do", "does", "doing", "down", "during", "each", "few", "for", "from", "further", "had", "has", "have", "having", "he", "he'd", "he'll", "he's", "her", "here", "here's", "hers", "herself", "him", "himself", "his", "how", "how's", "i", "i'd", "i'll", "i'm", "i've", "if", "in", "into", "is", "it", "it's", "its", "itself", "let's", "me", "more", "most", "my", "myself", "nor", "of", "on", "once", "only", "or", "other", "ought", "our", "ours", "ourselves", "out", "over", "own", "same", "she", "she'd", "she'll", "she's", "should", "so", "some", "such", "than", "that", "that's", "the", "their", "theirs", "them", "themselves", "then", "there", "there's", "these", "they", "they'd", "they'll", "they're", "they've", "this", "those", "through", "to", "too", "under", "until", "up", "very", "was", "we", |
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 wordWizard = require('./wordWizard') | |
| exports.getWordsCountInDesc = function (req, res) { | |
| let callBack = function (err, response) { | |
| if (err) { | |
| res.json({}); | |
| } else { | |
| res.json(response); | |
| } | |
| } |
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
| // Imports | |
| var express = require('express'); | |
| const bodyParser = require('body-parser'); | |
| const morgan = require('morgan'); | |
| const app = express(); | |
| const controller = require('./controller'); | |
| const profiler = require('v8-profiler'); | |
| const fs = require('fs'); | |
| // Middlewares |