Skip to content

Instantly share code, notes, and snippets.

View Janaka-Steph's full-sized avatar
🎯
Focusing

Janaka Janaka-Steph

🎯
Focusing
View GitHub Profile
@Janaka-Steph
Janaka-Steph / generate_wallets.js
Last active July 14, 2024 20:19
Generate wallets (Alice, Bob, Carol), create a json file and import private keys to Bitcoin Core
/**
* Generate wallets (Alice, Bob, Carol), create a json file and import private keys to Bitcoin Core
*
* BIP32 methods
* - fromBase58
* - fromPrivateKey
* - fromPublicKey
* - fromSeed
*
* BIP39 methods
@Janaka-Steph
Janaka-Steph / keybase_backup.sh
Created February 5, 2019 15:20 — forked from dwallraff/keybase_backup.sh
Encrypted tarball backup for keybase private folder backup
## Encrypt
tar cz * | openssl enc -e -aes-256-cbc -salt -out keybase_`date "+%Y%m%d"`.tar.gz.enc
## Decrypt
openssl enc -d -aes-256-cbc -salt -in <ENCRYPTED_KEYBASE_TARBALL> | tar xvz
## Crontab
10 12 * * * cd /Users/dwallraff/backups && tar cz /keybase/private/dwallraff | openssl enc -e -aes-256-cbc -salt -k $PASSWORD -out keybase_`date "+%Y%m%d"`.tar.gz.enc >/dev/null 2>&1
@Janaka-Steph
Janaka-Steph / Integrating next.js, Apollo Server and Koa
Last active January 31, 2020 15:20 — forked from lorefnon/package.json
Integrating next.js, Apollo Server and Koa
{
"main": "server/index.js",
"scripts": {
"dev": "nodemon --watch server server/index.js",
"build": "next build",
"start": "NODE_ENV=production node server/index.js"
},
"dependencies": {
"apollo-boost": "^0.1.13",
"apollo-server": "^2.0.4",
@Janaka-Steph
Janaka-Steph / 1_mongoose.js
Last active February 19, 2020 11:30 — forked from pasupulaphani/after_res_hooks.js
Mongoose connection best practices
var db = mongoose.connect('mongodb://localhost:27017/DB');
// In middleware
app.use(function (req, res, next) {
// action after response
var afterResponse = function() {
logger.info({req: req}, "End request");
// any other clean ups