Skip to content

Instantly share code, notes, and snippets.

View 0xB10C's full-sized avatar
💿

0xB10C 0xB10C

💿
View GitHub Profile
@0xB10C
0xB10C / intToDHHMMSS.js
Created August 13, 2017 21:38
A function that converts an integer (seconds) to a DHHMMSS string.
String.prototype.toDHHMMSS = function () {
var sec_num = parseInt(this, 10);
var days = Math.floor(sec_num / 86400)
var hours = Math.floor((sec_num - (days * 86400)) / 3600);
var minutes = Math.floor(((sec_num - (days * 86400)) - (hours * 3600)) / 60);
var seconds = sec_num - (days * 86400) - (hours * 3600) - (minutes * 60);
if (hours < 10) {hours = "0"+hours;}
if (minutes < 10) {minutes = "0"+minutes;}
if (seconds < 10) {seconds = "0"+seconds;}

Keybase proof

I hereby claim:

  • I am 0xb10c on github.
  • I am b10c (https://keybase.io/b10c) on keybase.
  • I have a public key whose fingerprint is 470B 847C 88D0 4928 77B7 F15D E462 234D D056 4D4A

To claim this, I am signing this object:

@0xB10C
0xB10C / buckets.py
Created October 17, 2017 21:23
a playground for bitcoin Core's fee estimation buckets
#!/usr/bin/python
# last bucket with more than 2^14 sat/byte
BUCKETCOUNT = 200
# defines a 5% increase per bucket
# https://github.com/bitcoin/bitcoin/commit/e5007bae35ce22036a816505038277d99c84e3f7#diff-8c0941572d1cdf184d1751f7b7f1db4eR109
FEE_SPACING = 1.05
# list of fee buckets
@0xB10C
0xB10C / nixcmds.md
Last active November 11, 2017 12:37
linux cmds I often forget
command function usage notes
scp remote -> local scp uname@remotehost:filename /local/dir
scp local -> remote scp filename uname@remotehost:/remote/dir
tar untar to dir tar -xfv archive.tar -C /target/directory (create dir first)
@0xB10C
0xB10C / 1000sat.py
Last active January 5, 2018 20:33
generates a list of mempool transactions with more than one 1000sat output
#!/usr/bin/env python
# requires https://github.com/petertodd/python-bitcoinlib
# just retry if a TypeError occurs on nodes without tx indexing (e.g. pruned nodes)
import bitcoin
import bitcoin.rpc
rpc = bitcoin.rpc.RawProxy()
rawmempool = rpc.getrawmempool(False);
@0xB10C
0xB10C / toYYYYMMDDString.js
Created March 30, 2018 11:19
Creates an YYYY-MM-DD String from a Date
Date.prototype.toYYYYMMDDString = function () {
return this.getFullYear() + "-" + ("0" + (this.getMonth()+1)).slice(-2) + "-" + ("0" + this.getDate()).slice(-2);
};
from __future__ import print_function
from bcc import BPF, USDT
import sys
from datetime import datetime
if len(sys.argv) < 2:
print("USAGE:", sys.argv[0], "path/to/bitcoind")
exit()
path = sys.argv[1]
debug = False
@0xB10C
0xB10C / shell.nix
Last active March 28, 2024 16:35
Nix shell for Bitcoin Core development (moved to https://github.com/0xB10C/nix-bitcoin-core)
# MOVED:
# To enable better collboration, I've moved the shell.nix to https://github.com/0xB10C/nix-bitcoin-core.
# Older revisions remain avaiable here.
# https://gist.github.com/0xB10C/1fd0d4a68bf96914775b1515340926f8/revisions
#
#
#
#
#
#
@0xB10C
0xB10C / bips.txt
Last active July 23, 2021 11:34 — forked from ajtowns/bips.txt
bip-activation-history
1MB limit (no bip):
commited: 2010-09-07
flag-day: 79400 2010-09-12
burial: 2010-09-20
dup-tx (bip 30):
bip: 2012-02-22
flag-day: 2012-03-15
p2sh (bip 16):
@0xB10C
0xB10C / perf-block-connect.bt
Created August 17, 2021 21:35
bpftrace script to benchmark the `CChainState::ConnectBlock` function of Bitcoin Core. Outputs CSV.
#!/usr/bin/env bpftrace
/*
USAGE:
bpftrace perf-block-connect.bt <end-height>
This script requires a 'bitcoind' binary compiled with eBPF support and the
'validation:block_connected' tracepoint. By default, it's assumed that 'bitcoind' is