Skip to content

Instantly share code, notes, and snippets.

View tcrowe's full-sized avatar
💭
Account archived | See link

Tony Crowe tcrowe

💭
Account archived | See link
View GitHub Profile
@tcrowe
tcrowe / create-couchdb-user.js
Last active October 18, 2015 19:04
create couchdb user programmatically through terminal
'use strict';
var inquirer = require('inquirer'),
chalk = require('chalk'),
nano = require('nano'),
questions;
questions = [
{
type: 'list',
@tcrowe
tcrowe / directory-pattern-matches.js
Created June 30, 2016 20:29
search the current directory for regexp pattern matches
var fs = require('fs'),
path = require('path'),
child_process = require('child_process'),
exec = child_process.exec,
pattern = /hello/gi,
fileList,
patternMatches = [];
// recursive directory listing
exec('find ' + __dirname, function (err, stdout, stderr) {
@tcrowe
tcrowe / webpack-yaml-multidoc-loader.js
Created July 16, 2017 09:27
Multiple document capable webpack loader, ES6 syntax, js-yaml
/*
yaml loader
+ safeLoad for one doc
+ safeLoadAll for multiple docs
questions:
+ does it need yaml parser `onWarning: this.emitWarning`?
+ does it need error handling e.g. `try-catch`?
@tcrowe
tcrowe / opti-node.js
Created October 3, 2017 02:37
Run node in a low memory or embedded environment (from 45MB normally to 14MB)
//
// node command-line arguments for making node run minimally in memory
//
let optiNodeArgs = [
// optimize for low memory system
'--optimize_for_size',
'--always_compact',
'--max_old_space_size=256',
// '--max_executable_size=300', // disabled in v8.x.x
@tcrowe
tcrowe / keybase.md
Created October 29, 2017 10:10
keybase proof

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@tcrowe
tcrowe / install-i2p.sh
Created May 22, 2018 20:05
homebrew brew install i2p over tor socks proxy
ALL_PROXY=socks5://127.0.0.1:9050 brew install i2p
@tcrowe
tcrowe / transaction-personal.js
Last active August 28, 2018 22:25
web3 transaction test: `getBalance` ➡️`unlockAccount` ➡️`sendTransaction`
/*
it will send transactions in a circle to each account
import aion account to node:
./aion.sh -a import private-key-hex
*/
let Web3 = require('../../src/index')
@tcrowe
tcrowe / circle-transaction-raw.js
Created August 28, 2018 22:30
Circle transactions with the client-side-encoded raw transaction.
/*
it will send transactions in a circle to each account
import aion account to node:
./aion.sh -a import private-key-hex
*/
let Web3 = require("../../src/index");
@tcrowe
tcrowe / medium-feed.js
Created September 10, 2018 18:41
process medium.com site feed xml into json into file
/*
medium feed processor:
---
+ npm install async xml2js lodash
+ add urls to feeds array to get more
+ npm run data-medium
*/
@tcrowe
tcrowe / redis-get-set-json.js
Created September 13, 2018 06:06
simple redis get set with json values
/*
⚠️expires keys in 10min so it's only good for temp data
Install:
npm install redis lodash
Usage: