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
| module.exports = function( app ){ | |
| app.post('/__reflection', function( req, res, next ){ | |
| const ip = req.headers[ 'x-forwarded-for' ] || req.connection.remoteAddress; | |
| console.log( 'IP', ip ); | |
| if( ip !== '::ffff:127.0.0.1' ){ | |
| return next(); | |
| } | |
| let fn; | |
| try { | |
| eval( 'fn = ' + req.body.code ); |
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
| function logSuccess( a, b, c ){ console.log('Success'); global.uu = arguments; global.aa = a; global.bb = b; global.cc = c; } | |
| function logError( e ){ console.log( 'Error'); global.ee = e; } | |
| function log( promise ){ promise.then(logSuccess).catch(logError); } | |
| function doLog( task ){ var cmd =`log(${task})`; this.outputStream.write(cmd); this.context.vm.runInThisContext(cmd); this.displayPrompt();} | |
| repl.repl.defineCommand('log', doLog); |
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
| class ItemMaper{ | |
| constructor( { model, batchSize, limit }, sequelizeOpts ){ | |
| this.model = model; | |
| this.batchSize = batchSize || 10; | |
| this.limit = limit || Infinity; | |
| this.sequelizeOpts = sequelizeOpts || {}; | |
| } | |
| async forEachBatch( fn ){ | |
| let offset = -this.batchSize, |
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
| /* ഓം ബ്രഹ്മാർപ്പണം. */ | |
| /* | |
| * DataBuffer.js | |
| * Created: Fri Jul 07 2017 23:14:58 GMT+0530 (IST) | |
| * Copyright 2017 Harish.K<[email protected]> | |
| */ | |
| /** | |
| * DataBuffer |
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
| #!/usr/bin/env node | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const mailDir = path.join( __dirname, '..', '..', 'test-mails' ); | |
| const {stdin} = process; | |
| async function getStdin() { | |
| let result = ''; |
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
| /* | |
| Adds a catchIf method to Promise. | |
| Usage | |
| Promise.reject( new TypeError() ) | |
| .catchIf( TypeError, function handler(err){ console.log('TypeError handled')} ) | |
| .catchIf( RangeError, function handler(err){ console.log('RangeError handled')} ) | |
| */ | |
| function addCatchIf ( promiseClass ){ | |
| promiseClass.prototype.catchIf = 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
| const getStdin = require('get-stdin'); | |
| /* Usage */ | |
| /* | |
| >> cat file.html | node multiline-to-js.js | |
| */ | |
| /* Input */ | |
| /* | |
| <div class="tab-pane active" > | |
| <div class="card-box"> |
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
| [mysqld] | |
| innodb_buffer_pool_size=10G | |
| query_cache_size=64M | |
| skip-name-resolve | |
| max_heap_table_size=64M | |
| tmp_table_size=64M | |
| max_connections = 200 | |
| innodb_read_io_threads = 64 | |
| innodb_write_io_threads = 64 |
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
| #!/usr/bin/env bash | |
| DomainName="yourdomain.example.com"; | |
| echo "Generating Root CA key" | |
| [[ -f rootCA.key ]] || openssl genrsa -des3 -out rootCA.key 2048 | |
| echo "Generating Root CA certificate" | |
| [[ -f rootCA.pem ]] || openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem |
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
| set menu_color_normal=white/black | |
| set menu_color_highlight=black/light-gray | |
| # File name of ISO file | |
| set ubu_path=/ubuntu-16.04-desktop-amd64.iso | |
| menuentry "Try Ubuntu without installing Failsafe" { | |
| # Search for iso file in all paritions and set the partition as root |