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/ |
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
| /* | |
| Create a folder called `folder-of-code` and then inside of that folder put | |
| other folders like foo and bar with different assets in them. Then run this | |
| server and notice how the static directory served will change depending on | |
| wether you hit `http://foo.lvh.me` and `http://bar.lvh.me`. | |
| Note you could rework this example to change the folder context depending on | |
| something in `req.params.*` but for this example we are using the wildcard |
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) | |
| async example() { | |
| console.log(await exec('ls')) | |
| console.log(await exec('ls')) | |
| } | |
| example() |