Skip to content

Instantly share code, notes, and snippets.

💭
(っ◕‿◕)っ

Tony Crowe tcrowe

💭
(っ◕‿◕)っ
View GitHub Profile
@tcrowe
tcrowe / create-couchdb-user.js
Last active Oct 18, 2015
create couchdb user programmatically through terminal
View create-couchdb-user.js
'use strict';
var inquirer = require('inquirer'),
chalk = require('chalk'),
nano = require('nano'),
questions;
questions = [
{
type: 'list',
@tcrowe
tcrowe / directory-pattern-matches.js
Created Jun 30, 2016
search the current directory for regexp pattern matches
View directory-pattern-matches.js
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 Jul 16, 2017
Multiple document capable webpack loader, ES6 syntax, js-yaml
View webpack-yaml-multidoc-loader.js
/*
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 Oct 3, 2017
Run node in a low memory or embedded environment (from 45MB normally to 14MB)
View opti-node.js
//
// 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 Oct 29, 2017
keybase proof
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@tcrowe
tcrowe / install-i2p.sh
Created May 22, 2018
homebrew brew install i2p over tor socks proxy
View install-i2p.sh
ALL_PROXY=socks5://127.0.0.1:9050 brew install i2p
@tcrowe
tcrowe / optimize-and-shut-up-npm.sh
Last active Dec 21, 2019
optimize and shut-up npm
View optimize-and-shut-up-npm.sh
npm config set -g send-metrics false
npm config set -g metrics-registry "http://127.0.0.1:11923"
npm config set -g ham-it-up false
npm config set -g optional false
npm config set -g loglevel error
npm config set -g init-version "0.1.0"
npm config set -g init-license "UNLICENSED"
npm config set -g init-author-url ""
npm config set -g init-author-email ""
npm config set -g init-author-name ""
@tcrowe
tcrowe / transaction-personal.js
Last active Aug 28, 2018
web3 transaction test: `getBalance` ➡️`unlockAccount` ➡️`sendTransaction`
View transaction-personal.js
/*
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 Aug 28, 2018
Circle transactions with the client-side-encoded raw transaction.
View circle-transaction-raw.js
/*
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 / ethersjs-abi-encode-decode.js
Last active Aug 31, 2018
ethersjs abi encode and decode
View ethersjs-abi-encode-decode.js
let ethers = require('ethers')
let abi = new ethers.utils.AbiCoder()
let types = ['address[][]', 'address[][]', 'address[][]']
let params = [[
[
'0x407d73d8a49eeb85d32cf465507dd71d507100c1',
'0x407d73d8a49eeb85d32cf465507dd71d507100c2',
You can’t perform that action at this time.