Skip to content

Instantly share code, notes, and snippets.

View LarryRuane's full-sized avatar

Larry Ruane LarryRuane

View GitHub Profile
@LarryRuane
LarryRuane / block-times.py
Created December 31, 2023 20:52
print heights of blocks with out-of-order timestamps
#!/usr/bin/env python3
# When two cosecutive blocks have out of order timestamps (the higher height's time
# is less than the lower height's time), print the height of the lower-height block.
#
# prerequisite;
# $ pip3 install python-bitcoinrpc
# or see https://github.com/jgarzik/python-bitcoinrpc
from bitcoinrpc.authproxy import AuthServiceProxy
api = AuthServiceProxy("http://lmr:lmr@127.0.0.1:8332")
@LarryRuane
LarryRuane / backtrace.txt
Created May 24, 2023 16:31
gdb backtrace (bt, stack trace) of prevector dynamically allocating memory during -reindex-chainstate, master commit 3a93957a5dc97cb2fd0656d1e2451ebef57204df
prevector<28u, unsigned char, unsigned int, int>::change_capacity (this=0x555561065eb8, new_capacity=67) at ./prevector.h:191
prevector<28u, unsigned char, unsigned int, int>::resize_uninitialized (this=0x555561065eb8, new_size=67) at ./prevector.h:392
Unserialize_impl<CAutoFile, 28u, unsigned char> (is=..., v=...) at ./serialize.h:782
Unserialize<CAutoFile, 28u, unsigned char> (is=..., v=...) at ./serialize.h:797
UnserializeMany<CAutoFile, prevector<28u, unsigned char, unsigned int, int>&> (s=..., arg=...) at ./serialize.h:1059
SerReadWriteMany<CAutoFile, prevector<28u, unsigned char, unsigned int, int>&> (s=..., ser_action=...) at ./serialize.h:1072
CScript::SerializationOps<CAutoFile, CScript, CSerActionUnserialize> (obj=..., s=..., ser_action=...) at ./script/script.h:435
CScript::Unser<CAutoFile> (s=..., obj=...) at ./script/script.h:435
CScript::Unserialize<CAutoFile> (this=0x555561065eb8, s=...) at ./script/script.h:435
Unserialize<CAutoFile, CScript&> (is=..., a=...) at ./serialize.h:705
@LarryRuane
LarryRuane / txo-flush-log-to-bin.py
Created May 16, 2023 23:07
temporary script to turn logging lines into binary
#!/bin/env python3
import sys
from struct import pack
if len(sys.argv) != 2:
print("usage:", sys.argv[0], "file")
sys.exit(1)
bitoffset = 0
v = 0
#!/bin/env python3
import sys
import random
if not len(sys.argv) == 4:
print("usage:", sys.argv[0], "reps points a-win-%")
sys.exit(1)
reps = int(sys.argv[1])
points = int(sys.argv[2])
@LarryRuane
LarryRuane / txo-history.py
Last active May 5, 2023 19:09
This prints one line for each tx output: 1) the output's txid, 2) its index, 3) its age in units of txos since genesis before being spent, 9999999999 means a long time or currently unspent
#!/usr/bin/env python3
import time, sys
from bitcoinrpc.authproxy import AuthServiceProxy
api = AuthServiceProxy("http://lmr:lmr@127.0.0.1:8332")
# infinite retry
def api_retry(*args):
global api
while True:
@LarryRuane
LarryRuane / witness-bytes.py
Created March 22, 2023 17:16
calculate total amount of chain witness data
#!/usr/bin/env python3
from bitcoinrpc.authproxy import AuthServiceProxy
api = AuthServiceProxy("http://lmr:lmr@127.0.0.1:8332")
info = api.getblockchaininfo()
tip_height = info['blocks']
print("tip height", tip_height)
witness = 0
for i in range(0, tip_height+1):
blockhash = api.getblockhash(i)
b = api.getblock(blockhash)
#include <iostream>
#include <string.h>
int line;
class String {
public:
char* m_buffer;
size_t m_size;
#include <iostream>
using namespace std;
class X {
public:
int i;
// ordinary cons X y(5):
X(int x) : i(x) { cout << "constructor " << i; }

CIA Torture Scandal Prosecutions

Is anyone in prison for the CIA torture scandal?

No one has been convicted or imprisoned for the CIA torture scandal. The Senate Intelligence Committee's report on the CIA's use of enhanced interrogation techniques, which were widely considered to be torture, was released in December 2014. The report detailed the CIA's use of waterboarding and other harsh methods on terrorism suspects in the years following the 9/11 attacks. However, no criminal charges have been brought against anyone involved in the program, and the Department of Justice has not pursued any prosecutions. Some human rights groups and lawmakers have called for those responsible to be held accountable, but to date, no one has been charged or convicted for their role in the CIA's enhanced interrogation program.


But wasn't the whistleblower who exposed the scandal put in prison?

A CIA officer named John Kiriakou was convicted in 2012 of violating the Espionage Act for disclosing classified in

#!/usr/bin/env python3
# show heights and timestamps of empty blocks, most recent first (so if using a pruned node,
# this will stop when we reach the start of the prune window)
from bitcoinrpc.authproxy import AuthServiceProxy
import json
from datetime import datetime
api = AuthServiceProxy("http://lmr:lmr@127.0.0.1:8332")
latest_height = api.getblockcount()
for i in range(latest_height, 1, -1):
bhash = api.getblockhash(i)