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
async function createAccount(){ | |
var USER_PREFIX = 'USER_PREFIX'; // change here. | |
var USER_PASS = 'USER_PASSWORD'; // change-here | |
var TIMER_DELAY = 300; | |
// password | |
await delay(TIMER_DELAY); | |
var password = document.getElementById('password1'); | |
password.value = USER_PASS; |
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
/** | |
* Download files and save it to disk using axios.js | |
* Download images, zip files using this function | |
* | |
* @param {Request URL} reqUrl | |
* @param {File name} fileName | |
*/ | |
function downloadFile(reqUrl, fileName){ | |
axios({ | |
method: "GET", |
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
Get-ChildItem -Path L:\senthil\ –Recurse | Out-File -filepath all-files-senthil.txt |
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 db = null // global variable to hold the connection | |
MongoClient.connect('mongodb://localhost:27017/', function(err, client) { | |
if(err) { console.error(err) } | |
db = client.db('test') // once connected, assign the connection to the global variable | |
}) | |
app.get('/', function(req, res) { | |
db.collection('test').find({}).toArray(function(err, docs) { | |
if(err) { console.error(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
//requiring path and fs modules | |
const path = require('path'); | |
const fs = require('fs'); | |
/** | |
* Read contents of files inside a folder. | |
* @param {*} folderName | |
* @param {*} rootDir | |
* | |
* @example : readFolder("data", __dirname) |
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 fs = require('fs'); | |
var axios = require('axios'); | |
const async = require('async'); | |
const path = require('path'); | |
const DL_INTERVAL_TIMER = 500; //in milliseconds. | |
module.exports = { | |
createFolder: function (dir) { | |
if (!fs.existsSync(dir)) { |
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'), | |
directory = require('serve-index'), | |
app = new express(); | |
var hourMs = 1000*60*60; | |
app.use(express.static(__dirname + '/public', { maxAge: hourMs })); | |
app.use(directory(__dirname + '/public', { 'view' : 'details'})); | |
app.listen(4433); |
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
async function createAccount(){ | |
var USER_PREFIX = 'USERNAME'; // change here. | |
var USER_PASS = 'PASSWORD'; // change-here | |
var TIMER_DELAY = 400; | |
// username | |
await delay(TIMER_DELAY); | |
var randomGuid = guid(); |
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 path = require('path'); | |
const fs = require('fs'); | |
function readFilesFromDir(dir) { | |
var filelist = []; | |
walkSync(dir, filelist); | |
return filelist; | |
} | |
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 fastify = require('fastify')({ logger: true }); | |
const axios = require('axios'); | |
const path = require('path'); | |
const routes = require('./routes/route'); | |
//console.log(route); | |
routes.forEach((route, index) => { | |
fastify.route(route) | |
}); |