Skip to content

Instantly share code, notes, and snippets.

View rustyrussell's full-sized avatar

Rusty Russell rustyrussell

View GitHub Profile
rustyrussell / megatx-benchmark.c
Created July 8, 2015 03:18
Simple bitcoin signature hashing benchmark code
/* Usage: benchmark-sha256 <numtxs> [<numiterations>]
* Benchmark the input signature hashes for a maximum-sized transaction with this many
* inputs
* Rusty Russell, <> GPLv3.
#include <ccan/crypto/sha256/sha256.c>
#include <ccan/time/time.h>
#include <stdio.h>
#include <string.h>
rustyrussell / nodeid-flag.c
Last active September 15, 2023 05:07
Quick hack to create nodeid flags using block hashes
#include <ccan/crypto/sha256/sha256.h>
#include <ccan/err/err.h>
#include <ccan/opt/opt.h>
#include <ccan/short_types/short_types.h>
#include <ccan/str/hex/hex.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
int main(int argc, char *argv[])
rustyrussell / gist:762297e84dc5239fe408c45e6811e1a9
Created August 23, 2022 02:04
reckless tool usage sketches
"reckless install <url>"
- might turn simple names (.e.g summary) into references to the GH plugins repo
- allow URLs to inside repos for GH plugins.
- if first run, creates ~/.lightning/reckless/, puts in empty "bitcoin.config" and 'include ../reckless/bitcoin.config' if not already in ~/.lightning/bitcoin/config
- download and unpack/move into ~/.lightning/reckless/<subdir>
- perform simple check (e.g. for Python, you can run the plugin normally and it should exit with status 0).
- start up dynamically
- if it works, add to reckless/bitcoin.config
/* Simple wrapper to allow a program to perf itself.
* Copyright Rusty Russell, Blockstream 2015.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
rustyrussell / times-headlines.txt
Created October 29, 2021 03:02
The Times Headlines December 2008 and January 2009
Dec 2008:
1: Tory MP is accused of orchestrating leaks
2: Officials who failed Baby P are forced out
3: De Menezes coroner rules out unlawful killing verdict
4: Emergency rescue for mortgage defaulters
5: Rates cut again as recession deepens
6: Vauxhall in secret cash plea to save 5,000 jobs
8: Traditional subjects go in schools shake-up
9: Brown's recovery gathers pace with new poll boost
rustyrussell / permute-image.c
Created February 21, 2020 04:53
Quick code to scramble / unscramble an image given a key.
#include <ccan/array_size/array_size.h>
#include <ccan/asort/asort.h>
#include <ccan/crypto/sha256/sha256.h>
#include <ccan/err/err.h>
#include <ccan/str/hex/hex.h>
#include <ccan/short_types/short_types.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_pixels.h>
= Header
== Header 2
=== Header 3
= Header
== Header 2
=== Header 3
diff --git a/gossipd/gossip_wire.csv b/gossipd/gossip_wire.csv
index 63392d87b..7b36f9831 100644
--- a/gossipd/gossip_wire.csv
+++ b/gossipd/gossip_wire.csv
@@ -37,6 +37,7 @@ msgdata,gossip_getroute_request,fuzz,double,
#include "../lightning/external/libwally-core/include/wally_address.h"
#include "../lightning/external/libwally-core/include/wally_bip32.h"
#include "../lightning/external/libwally-core/src/secp256k1/include/secp256k1.h"
#include "../lightning/common/bech32.c"
#include <ccan/crypto/sha256/sha256.h>
#include <ccan/crypto/ripemd160/ripemd160.h>
#include <ccan/str/hex/hex.h>
#include <err.h>
#include <assert.h>
#include <stdio.h>