Skip to content

Instantly share code, notes, and snippets.

View kristapsk's full-sized avatar

Kristaps Kaupe kristapsk

View GitHub Profile
@kristapsk
kristapsk / zeroconf.md
Created August 7, 2026 09:22 — forked from RobinLinus/zeroconf.md
A Protocol for Zero-Confirmation Bitcoin Payments

Protocol for Zero-Confirmation Bitcoin Payments

Overview

This protocol lets a Bitcoin user make zero-confirmation payments while retaining a trustless unilateral exit path if the co-signing server disappears or refuses to cooperate.

  • The user keeps funds in a confirmed 2-of-2 multisig with a co-signing server.
  • The co-signer enforces a policy of not signing conflicting spends.
  • Recipients can accept zero-confirmation payments if they trust the co-signer's policy.
  • The user receives a pre-signed unilateral exit transaction before depositing funds.
@kristapsk
kristapsk / void_linux_hetzner_arm_ipv6.md
Created August 26, 2025 17:57 — forked from glelk/void_linux_hetzner_arm_ipv6.md
Void Linux installation on Hetzner Cloud VPS (Arm64/IPv6-only)

Void Linux installation on Hetzner Cloud VPS

(Arm64/IPv6-only)

This guide describes how to install Void Linux on ARM Hetzner Cloud instances with IPv6-only setup.

image

Table of contents:

@kristapsk
kristapsk / accesslog2csv.py
Last active March 22, 2023 19:24 — forked from joswr1ght/accesslog2csv.py
Convert Apache/Nginx Unified Log Format to CSV
#!/usr/bin/env python3
# accesslog2csv: Convert default, unified access log from Apache, Nginx
# servers to CSV format.
#
# Original source by Maja Kraljic, July 18, 2017
# Modified by Joshua Wright to parse all elements in the HTTP request as
# different columns, December 16, 2019
# Modified by Kristaps Kaupe to support (ignore) additional fields at the end and also added shebang at March 2023
#!/usr/bin/env bash
lockdir=/tmp/satsale.lock
if mkdir "$lockdir" 2> /dev/null ; then
trap 'rm -rf "$lockdir"' 0
trap "exit 2" 1 2 3 15
else
exit 0
fi
Utxos are grouped by address type (P2PKH, P2SH-P2WPKH, or P2WPKH).
The group with the same address type as the address being spent to is selected if it is >= twice the spend amount.
If the above condition is not met, then a group with a different address type and a total value >= twice the spend amount is selected.
If the above condition is not met, then 2 groups with total amounts >= the spend amount are chosen.
Transaction composition is arranged by “sets”.
For each set:
The utxos are processed in randomised order.
#!/usr/bin/env bash
while :; do
lightning-cli listpeers | jq -r ".peers[].id" | while read node_id; do
if [[ $((RANDOM % 2)) != 0 ]]; then
echo "Pinging $node_id"
lightning-cli ping $node_id $((RANDOM % 65530)) $((RANDOM % 65530))
fi
done
echo "[$(date -u +"%Y-%m-%dT%H:%M:%SZ")] sleeping..."
@kristapsk
kristapsk / odroid-hc4-raspibolt-notes.md
Last active December 2, 2021 00:58
Odroid HC4 RaspiBolt installation notes

Odroid HC4 RaspiBolt installation notes

Upgrading

Upgrading kernel will make it unbootable.

# apt update
# apt-mark hold linux-odroid-c4
linux-odroid-c4 set on hold.

Keybase proof

I hereby claim:

  • I am kristapsk on github.
  • I am kristapsk (https://keybase.io/kristapsk) on keybase.
  • I have a public key ASBHmqoD_9bKZ-aOHjBP4NPx_q1EtPBCbxvBWUmDSK-9sgo

To claim this, I am signing this object:

<?php
$algo = 'sha512';
$algo_iter = 100;
$rand = ord(openssl_random_pseudo_bytes(1));
$pass = 'password';
$salt = openssl_random_pseudo_bytes(16);
$salt_hex = bin2hex($salt);
$finished = false;
$val = hash($algo, hash($algo, $pass) . $salt);
for ($i = 0; $i <= 255; $i++) {
@kristapsk
kristapsk / hhvm-fullUrl.patch
Created November 23, 2016 16:19
HHVM fullUrl patch for ServerStats
diff --git a/hphp/runtime/server/http-request-handler.cpp b/hphp/runtime/server/http-request-handler.cpp
index 4b5c3f4..8369e8e 100644
--- a/hphp/runtime/server/http-request-handler.cpp
+++ b/hphp/runtime/server/http-request-handler.cpp
@@ -180,8 +180,7 @@ void HttpRequestHandler::handleRequest(Transport *transport) {
}
}
- ServerStats::StartRequest(transport->getCommand().c_str(),
- transport->getRemoteHost(),