Skip to content

Instantly share code, notes, and snippets.

View rjcorwin's full-sized avatar

R.J. (Steinert) Corwin rjcorwin

View GitHub Profile
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')
let username = '';
let password = '';
let dbName = '';
const PouchDB = require('pouchdb')
const DB = PouchDB.defaults({
prefix: '/tangerine/db/'
});
try {
ls -l | awk '{print $9}' | xargs -I {} sh -c 'echo {} && find ./{} -print | wc -l'
for f in *; do mv "$f" "$(echo "$f" | sed s/$1/$2/)"; done
#!/usr/bin/env node
const util = require('util');
const exec = util.promisify(require('child_process').exec)
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
const sleep = (milliseconds) => new Promise((res) => setTimeout(() => res(true), milliseconds))
#/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
wget --recursive --no-clobber --page-requisites --html-extension --convert-links --domains $1 http://$1
cd $1
dat share
dat://3c2f7c59b4bae4cb10d11effa65d3b144f1e0c06416406c0d39e9d1dabbbe76b/