This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first boot | |
ssh root@odroid | |
# dependencies | |
apt-get update | |
apt-get full-upgrade | |
apt-get install fswatch jq rsync curl python3 python3-pip | |
apt autoremove | |
# swapfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bitcoin-cli getrawtransaction 54e48e5f5c656b26c3bca14a8c95aa583d07ebe84dde3b7dd4a78f4e4186e713 | sed 's/0100000000000000/\n/g' | tail -n +2 | cut -c7-136,139-268,271-400 | tr -d '\n' | cut -c17-368600 | xxd -p -r > bitcoin.pdf |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BLOCK=$(bitcoin-cli getblockcount) | |
for ((i=BLOCK; i>=1; i--)) | |
do | |
echo $i | |
bitcoin-cli getblock $(bitcoin-cli getblockhash $i) 3 | jq -L $HOME -r 'include ".jq/decode_hex"; | |
.tx[] | select(any(.vout[]; .scriptPubKey.type == "nulldata" and .value != 0)) | .txid + " " + (.vout[0].value * 1e8 | tostring) + " " + (.vout[0].scriptPubKey.hex[4:] | decode_hex)' | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def decode_hex: | |
def decode: if . < 58 then .-48 elif . < 91 then .-55 else .-87 end; | |
def decode_byte: map(decode) | (.[0] * 16) + .[1]; | |
def pairs: explode | range(0;length;2) as $i | [.[$i], .[$i+1]]; | |
def filter: if (. < 32 or (. >= 128 and . <= 159)) then 46 else . end; | |
[pairs|decode_byte|filter] | implode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TIME=$(date -d "$1" +"%s") | |
function getBlockTime { | |
echo $(bitcoin-cli getblockheader $(bitcoin-cli getblockhash $1) | jq -r .time) | |
} | |
function binarySearch { | |
L=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CURRENTHEIGHT=$(bitcoin-cli getblockchaininfo | jq -r .blocks) | |
DIFFICULTY=1 | |
for ((HEIGHT = 0 ; HEIGHT < CURRENTHEIGHT ; HEIGHT += 2016)) | |
do | |
NEW_DIFFICULTY=$(bitcoin-cli getblock $(bitcoin-cli getblockhash $HEIGHT) | jq -r .difficulty) | |
ADJUSTMENT=$(bc <<< "scale=16 ; ((($NEW_DIFFICULTY * 100 / $DIFFICULTY)) - 100)" | awk '{printf("%.2f \n",$1)}') | |
echo $((HEIGHT / 2016)) $HEIGHT $NEW_DIFFICULTY $ADJUSTMENT | |
DIFFICULTY=$NEW_DIFFICULTY | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BOXES = [[ '₿', '₿'], // Box A | |
[ '₿', '💩'], // Box B | |
['💩', '💩']] // Box C | |
var count = 0, success = 0; | |
while(count <= 1_000_000) { | |
// You choose a box at random | |
var drawbox = Math.floor(Math.random() * 3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (block_height = 0; block_height < 6_930_000; block_height += 210_000) { | |
epoch = Math.floor(block_height / 210_000) + 1 | |
coin = 100_000_000 | |
reward = Math.floor(100 * coin / Math.pow(2, epoch)) | |
supply = 0 | |
for (i = 1; i <= epoch; i++) { | |
supply += Math.floor(100 * coin / Math.pow(2, i)) * 210_000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var input = process.argv[2].split(':') | |
var result = (BigInt(input[0]) << 40n) + (BigInt(input[1]) << 16n) + (BigInt(input[2])) | |
console.log(result.toString()) |
NewerOlder