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
# ~/.ssh/config | |
Host <custom-name> | |
HostName <remote-host> | |
User <remote-user> | |
Port <remote-ssh-port> | |
IdentityFile ~/.ssh/id_rsa | |
ForwardAgent yes | |
ProxyCommand ssh -o 'ForwardAgent yes' <proxy-user>@<proxy-host> 'ssh-add && nc %h %p' |
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
/* | |
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
// 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
// |
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
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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
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'); |