Skip to content

Instantly share code, notes, and snippets.

Christopher Jeffrey (JJ) chjj

Block or report user

Report or block chjj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View track.sh
# Track fedex/ups/usps/iparcel/upsmi packages.
track-package() {
local open track fedex ups usps len url i \
urls upsmi iparcel iparcel_ usps_ dhl ontrac
if test -z "$1"; then
return 1
fi
if test "$1" = 'open'; then
@chjj
chjj / scrypt.js
Last active Nov 18, 2018
javascript scrypt implementation
View scrypt.js
/*!
* scrypt
* Copyright (c) 2016, Christopher Jeffrey (MIT License).
*
* Ported from:
* https://github.com/Tarsnap/scrypt/blob/master/lib/crypto/crypto_scrypt-ref.c
*
* Copyright 2009 Colin Percival
* All rights reserved.
*
@chjj
chjj / bitcoin.md
Created Apr 16, 2016
The bitcoin paper in markdown (because PDFs suck)
View bitcoin.md

Bitcoin: A Peer-to-Peer Electronic Cash System

Satoshi Nakamoto satoshin@gmx.com (www.bitcoin.org)

Abstract. A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution. Digital signatures provide part of the solution, but the main benefits are lost if a trusted third party is still required to prevent double-spending. We propose a solution to the double-spending problem using a peer-to-peer network. The network timestamps transactions by hashing them into

View satoshi-sig-generator.js
'use strict';
// original: https://gist.github.com/indutny/8d0f5376ee643962a9f0
const BN = require('bn.js');
const elliptic = require('elliptic');
const bcoin = require('bcoin');
const ecdsa = new elliptic.ec('secp256k1');
View satoshi-sigs.js
/**
* Hashes signed by satoshi which do not appear on the blockchain.
* All of these hashes and signatures verify against satoshi's original public key of:
* 0411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3
*
* First TX in bitcoin history:
* https://blockchain.info/tx/f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16?show_adv=true
*
* The pubkey used to redeem the funds:
* https://blockchain.info/tx-index/14862/0
View normalize-der.js
exports.normalize = function normalize(signature) {
var data, p, len, rlen, slen;
if (Buffer.isBuffer(signature))
signature = Array.prototype.slice.call(signature);
else if (typeof signature === 'string')
signature = utils.toArray(signature, 'hex');
data = signature.slice();
p = { place: 0 };
View github_error
┌─ chjj@slickrick ~/work/node_modules/bcoin [wallet-bip45$]
└ $ git push origin wallet-bip45
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 1.38 KiB | 0 bytes/s, done.
Total 7 (delta 5), reused 0 (delta 0)
remote: /data/github/current/config/basic.rb:67:in `require': cannot load such file -- /data/github/current//data/github/current/vendor/ruby/b3255a8b572160bf249b5019c1ec93e667d547ee/lib/ruby/2.1.0/x86_64-linux/rbconfig.rb (LoadError)
remote: from /data/github/current/config/basic.rb:67:in `require'
remote: from /data/github/current/config/basic.rb:210:in `<top (required)>'
View keybase.md

Keybase proof

I hereby claim:

  • I am chjj on github.
  • I am chjj (https://keybase.io/chjj) on keybase.
  • I have a public key whose fingerprint is B4B1 F62D BAC0 84E3 33F3 A04A 8962 AB9D E666 6BBD

To claim this, I am signing this object:

View tx-pool-fix-clean.js
var fs = require('fs');
var assert = require('assert');
var bcoin = require('bcoin');
var bn = require('bn.js');
var parser = new bcoin.protocol.parser;
var wallet = new bcoin.wallet({
pub: bcoin.utils.fromBase58('hY29VUa4xfrs4vDUd4aF3cjkMoH5xegU6VzGNBqjTtCm')
});
View gist:9647483
/home/cjj/work/node_modules/square/lib/square.js:1517
return fn(err);
^
TypeError: undefined is not a function
at done (/home/cjj/work/node_modules/square/lib/square.js:1517:14)
at reduced (/home/cjj/work/node_modules/square/lib/square.js:1430:21)
at /home/cjj/work/node_modules/square/node_modules/async/lib/async.js:251:13
at /home/cjj/work/node_modules/square/node_modules/async/lib/async.js:133:21
at /home/cjj/work/node_modules/square/node_modules/async/lib/async.js:248:17
at preprocessing (/home/cjj/work/node_modules/square/lib/square.js:708:27)
You can’t perform that action at this time.