Skip to content

Instantly share code, notes, and snippets.

@afk11
afk11 / tmux
Created September 21, 2021 18:46
set -g default-terminal 'screen-256color'
# set-option -g default-command "reattach-to-user-namespace -l zsh"
bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
bind C-v run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
#set-option -g default-shell /bin/zsh
#set-option -g default-command "/bin/zsh -i"
# Remap prefix to Control + a
@afk11
afk11 / base32-consistency-tester.php
Created February 26, 2021 12:36
Base32 consistency check brute forcer. Can be given a shard to run over multiple cores.
<?php
/**
* This is a brute force script to test all 8-bit, 16-bit and 32-bit byte strings
* using the new Base32 implementation.
* - first ensure both implementations produce the same encoding
* - then ensure the new implementation can decode the encoding
*
* To spread the work over multiple cores, provide a prefix and bit len:
* eg: Two cores (half CPU time)
* php tester.php 1 1 # bitlen=1, prefix=1
@afk11
afk11 / bitcoind-zmq-quiet.txt
Last active January 30, 2020 16:39
'Quiet' ZMQ tx notifications during reorg
rawtx tx1 <- TransactionAddedToMempool
rawtx tx2 <- TransactionAddedToMempool
rawtx tx3 <- TransactionAddedToMempool
rawtx blka1CoinBase <- BlockConnected
rawtx tx1 <- BlockConnected
rawtx tx2 <- BlockConnected
rawtx tx3 <- BlockConnected
rawblock blk1a (tx1, tx2, tx3) <- UpdatedTip
@afk11
afk11 / bitcoind-zmq-too-many-notifications.txt
Last active January 30, 2020 16:39
Default behaviour of bitcoind ZMQ notifications during reorg
Default behaviour
rawtx tx1 <- TransactionAddedToMempool
rawtx tx2 <- TransactionAddedToMempool
rawtx tx3 <- TransactionAddedToMempool
rawtx blka1CoinBase <- BlockConnected
rawtx tx1 <- BlockConnected
rawtx tx2 <- BlockConnected
rawtx tx3 <- BlockConnected
For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 26065
[New LWP 26067]
[New LWP 26068]
[New LWP 26069]
[New LWP 26070]
[New LWP 26071]
[New LWP 26072]
[New LWP 26077]
For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 8226
[New LWP 8227]
[New LWP 8228]
[New LWP 8229]
[New LWP 8230]
[New LWP 8231]
[New LWP 8232]
[New LWP 8237]
@afk11
afk11 / download_signal.sh
Created January 6, 2020 15:38
Download and verify Signal APK
#!/bin/bash
version="$1"
download_dir="$HOME/signal"
unverified_dir="$download_dir/unverified"
tmp_dir="$download_dir/tmp"
certify_key="29:F3:4E:5F:27:F2:11:B4:24:BC:5B:F9:D6:71:62:C0:EA:FB:A2:DA:35:AF:35:C1:64:16:FC:44:62:76:BA:26"
# Version must be provided
if [ "$version" = "" ]; then
@afk11
afk11 / gist:e623091081632185092aa21552c6de81
Created November 9, 2019 15:19
feature_taproot_test.py
#!/usr/bin/env python3
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Test taproot softfork.
from test_framework.blocktools import create_coinbase, create_block, create_transaction, add_witness_commitment
from test_framework.messages import CTransaction, CTxIn, CTxOut, COutPoint, CTxInWitness, uint256_from_str
from test_framework.script import CScript, TaprootSignatureHash, taproot_construct, OP_0, OP_1, OP_2, OP_HASH160, OP_CHECKSIG, OP_CHECKSIGVERIFY, OP_CHECKSIGADD, OP_IF, OP_CODESEPARATOR, OP_ELSE, OP_ENDIF, OP_DROP, DEFAULT_TAPSCRIPT_VER, SIGHASH_ALL, SIGHASH_SINGLE, is_op_success, CScriptOp, OP_RETURN, OP_VERIF, OP_RESERVED, OP_1NEGATE, OP_EQUAL, OP_SWAP, OP_CHECKMULTISIG, OP_CHECKMULTISIGVERIFY, OP_NOTIF, OP_2DROP, OP_NOT, OP_2DUP, OP_1SUB, OP_DUP, MAX_SCRIPT_ELEMENT_SIZE, LOCKTIME_THRESHOLD, ANNEX_TAG, hash160, OP_EQUALVERIFY
from test_framework.test_framework
#!/bin/bash
# takes a file path (Dir or file) to tar,
# and a second argument, the prefix of the generated key & tarball.
# PUBKEY_FILE is hardcoded, should be changed
if [ $1 = "" ]; then
echo "filepath is required"
exit -1;
fi
if [ $2 == "" ]; then
#!/usr/bin/env php
<?php
if ($argc < 1) {
die("missing directory");
} else if ($argv < 2) {
die("missing search string");
}
$dir = $argv[1];