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 util = require('util'); | |
| const exec = util.promisify(require('child_process').exec) | |
| const go = async () => { | |
| try { | |
| const output1 = await exec('echo 1') | |
| console.log(output1.stdout) | |
| const output2 = await exec('echo 2') | |
| console.log(output2.stdout) | |
| const output3 = await exec('echo 3') |
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
| let username = ''; | |
| let password = ''; | |
| let dbName = ''; | |
| const PouchDB = require('pouchdb') | |
| const DB = PouchDB.defaults({ | |
| prefix: '/tangerine/db/' | |
| }); | |
| try { |
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
| ls -l | awk '{print $9}' | xargs -I {} sh -c 'echo {} && find ./{} -print | wc -l' |
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
| for f in *; do mv "$f" "$(echo "$f" | sed s/$1/$2/)"; done |
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 util = require('util'); | |
| const exec = util.promisify(require('child_process').exec) |
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 EventEmitter = require('events'); | |
| const sleep = (milliseconds) => new Promise((res) => setTimeout(() => res(true), milliseconds)) | |
| class PouchDbChangesFeedWorker extends EventEmitter { | |
| // @TODO Instead of napTime, we could subscribe to the changes feed and wake on activity. | |
| constructor (feeds = [], changeProcessor, PouchDB, batchSize = 5, sleepTimeAfterBatchProcessed = 0, sleepTimeAfterNoChanges = 3000, batchLimit = undefined) { | |
| super() | |
| this._feeds = feeds | |
| this._changeProcessor = changeProcessor |
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 sleep = (milliseconds) => new Promise((res) => setTimeout(() => res(true), milliseconds)) |
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
| #/bin/bash | |
| # First param is the string to match, second is the destination directory. | |
| ls -d -1 $PWD/* | sed 's/\ /\\\ /g' | sed 's/\*/\\\*/g' | sed 's/\#/\\\#/g' | sed "s/\'/\\\'/g" | grep $1 | xargs -I {} cp "{}" $2 |
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
| dat://3c2f7c59b4bae4cb10d11effa65d3b144f1e0c06416406c0d39e9d1dabbbe76b/ |