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
const fs = require('fs'); | |
const path = require('path'); | |
const { promisify } = require('util'); | |
const { exec: childExec } = require('child_process'); | |
const ProgressBar = require('ascii-progress'); | |
const readDir = promisify(fs.readdir); | |
const exec = promisify(childExec); | |
const workingDir = process.cwd(); |
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
const { promises: fs, createReadStream } = require('fs'); | |
const { Transform } = require('stream'); | |
const path = require('path'); | |
const uuid = require('uuid/v4'); | |
const ProgressBar = require('ascii-progress'); | |
const algolia = require('algoliasearch'); | |
const { ALGOLIA_APP_ID, ALGOLIA_API_KEY } = process.env; | |
const client = algolia(ALGOLIA_APP_ID, ALGOLIA_API_KEY); |
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
// |
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
// Usage : node find-repo-dependencies /path/to/projects/folder | |
const path = require('path'); | |
const fs = require('fs'); | |
const folder = path.resolve(process.argv[2]); | |
fs | |
.readdirSync(folder) | |
// Absolute path | |
.map(item => path.join(folder, item)) |
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
/* | |
node refactor.js --dirs src/actions src/components | |
Before : | |
- src | |
- actions | |
messenger.js | |
messenger.test.js | |
login.js |
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
npm init --scope=<orgName> | |
npm publish --access public |
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
// You need to setup a working mediasoup SFU server first | |
// see : https://mediasoup.org/api/#webrtc | |
// Map userId => streamId | |
// Local to a room | |
const userStreams = {}; | |
// Mediasoup peer | |
const mediaPeer = mediaRoom.Peer(participant.id); |
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
#!/usr/bin/env node | |
const glob = require('glob'); | |
const fs = require('fs'); | |
const sh = require('shelljs'); | |
const SRC_DIR = 'src'; | |
const DEST_DIR = 'build'; | |
glob(`${SRC_DIR}/**/*(*.json|!(*.js))`, (err, files) => { | |
if (err) { |
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
const id = '__JUNK__'; | |
// Public key need to be in PKCS8 format | |
// ssh-keygen -e -m PKCS8 -f id_rsa.pub > id_rsa.pkcs8 | |
const publicKey = fs.readFileSync(path.join(__dirname, 'id_rsa.pkcs8'), { encoding : 'utf8' }); | |
const privateKey = fs.readFileSync(path.join(__dirname, 'id_rsa'), { encoding : 'utf8' }); | |
// Sign | |
const signer = crypto.createSign('RSA-SHA512'); | |
signer.update(id); | |
const signature = signer.sign(privateKey, 'hex'); |
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
module.exports = { | |
config: { | |
// default font size in pixels for all tabs | |
fontSize: 12, | |
// font family with optional fallbacks | |
fontFamily: 'Menlo, "DejaVu Sans Mono", "Lucida Console", monospace', | |
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk) | |
cursorColor: '#fff', |
NewerOlder