Skip to content

Instantly share code, notes, and snippets.

View justmoon's full-sized avatar

Stefan Thomas justmoon

View GitHub Profile
@justmoon
justmoon / 0001-Enable-LiveObjectList.patch
Created August 23, 2011 04:24
Node.js - Enable LiveObjectList in d8 debugger (tested with v0.4.10)
From f1f6f7bf486a2d6ceebe51063676212a91cb3ed3 Mon Sep 17 00:00:00 2001
From: Stefan Thomas <justmoon@members.fsf.org>
Date: Tue, 23 Aug 2011 05:22:44 +0100
Subject: [PATCH] Enable LiveObjectList.
---
deps/v8/src/liveobjectlist.cc | 138 +++++++++++++++++++++++++++++-----------
wscript | 2 +-
2 files changed, 101 insertions(+), 39 deletions(-)
> bigint@0.3.7 install /atlas/www/node-bitcoin-p2p/node_modules/bigint
> node-waf configure build
> buffertools@1.0.5 preinstall /atlas/www/node-bitcoin-p2p/node_modules/buffertools
> ./build-wrapper
Checking for program g++ or c++ : /usr/bin/g++
Setting srcdir to : /atlas/www/node-bitcoin-p2p/node_modules/buffertools
Setting blddir to : /atlas/www/node-bitcoin-p2p/node_modules/buffertools/build
@justmoon
justmoon / results.txt
Created November 2, 2011 22:28
Node.js Buffer#copy performance
Node.js 0.4.12
--------------
Buffer (10 bytes):
Buffer#copy x 233,570 ops/sec ±0.96% (74 runs sampled)
Buffer[] x 1,152,607 ops/sec ±2.57% (72 runs sampled)
Fastest is Buffer[]
@justmoon
justmoon / gist:1492987
Created December 18, 2011 10:32
NPM VPS crash
justmoon@atlas:~/opt$ rm -r node_modules/
justmoon@atlas:~/opt$ rm -r ../.npm/
justmoon@atlas:~/opt$ rm npm-debug.log
justmoon@atlas:~/opt$ npm install -v bitcoinjs
1.1.0-alpha-6
justmoon@atlas:~/opt$ npm install -verbose bitcoinjs
npm info it worked if it ends with ok
npm verb cli [ 'node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'install',
@justmoon
justmoon / gist:1534875
Created December 29, 2011 16:35
BlockChain, main processing sequence, Step example
/**
* Connect a block and store it.
*
* This function takes over once add() has ascertained that the block passed
* intrinsic checks and there is no reorg currently in progress.
*/
var processBlock = this.processBlock = function processBlock(bw) {
// Shorthand
var block = bw.block;
@justmoon
justmoon / main.c
Created January 1, 2012 02:45
OP_EVAL exploit miner
#include <stdio.h>
#include <openssl/ripemd.h>
#include <openssl/rand.h>
void print_hex(unsigned char *bytes, unsigned int len) {
int i;
for (i = 0; i < len; i++) {
printf("%02X", bytes[i]);
}
printf("\n");
@justmoon
justmoon / gist:3440704
Created August 23, 2012 19:38
SJCL BN divInt
/** this /= (int) that */
sjcl.bn.prototype.divIntM = function (that) {
var i, limbs = this.limbs, ll = limbs.length, carry = 0, quotient;
if (this.sign() === -1) {
throw (new sjcl.exception.invalid("divIntM: dividend must be > 0"));
}
if ("number" !== typeof that ||
@justmoon
justmoon / index.html
Created August 29, 2012 07:51
node-webkit Crash/Error with node-buffertools
<script type="text/javascript">
require("buffertools");
console.log("It gets this far.");
new Buffer(32).clear();
console.log("But never this far.");
</script>
@justmoon
justmoon / index.html
Created September 10, 2012 07:51
node-webkit Crash/Error with node-bignum
<script type="text/javascript">
var bignum = require("bignum");
console.log("It gets this far.");
bignum(2).pow(256);
console.log("But never this far.");
</script>
@justmoon
justmoon / gist:3927036
Created October 21, 2012 13:54
bitcoinjs-lib 0.1 Script Inclusion Order
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/crypto-js/crypto.js"></script>
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/crypto-js/sha256.js"></script>
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/crypto-js/ripemd160.js"></script>
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/jsbn/prng4.js"></script>
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/jsbn/rng.js"></script>
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/jsbn/jsbn.js"></script>
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/jsbn/jsbn2.js"></script>
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/jsbn/ec.js"></script>