Skip to content

Instantly share code, notes, and snippets.

View rustyrussell's full-sized avatar

Rusty Russell rustyrussell

View GitHub Profile
@rustyrussell
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
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.
Technical:
- 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
@rustyrussell
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
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,
msgdata,gossip_getroute_request,num_excluded,u16,
msgdata,gossip_getroute_request,excluded,short_channel_id_dir,num_excluded
msgdata,gossip_getroute_request,max_hops,u32,
+msgdata,gossip_getroute_request,hard_limit,bool,
#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>
@rustyrussell
rustyrussell / build-release.sh
Created October 26, 2018 00:42
Release script for c-lightning
#! /bin/sh
set -e
if [ "$(git status --porcelain -u no)" != "" ]; then
echo "Not a clean git directory" >&2
exit 1
fi
VERSION=`git tag --points-at HEAD`
if [ "$VERSION" = "" ]; then
@rustyrussell
rustyrussell / Bbock.hex
Created July 4, 2018 05:02
bitcoin-cli getblock 0000000000000000000fda35b2a2a3e24009d64f043c9f0370825a7193667232 false
This file has been truncated, but you can view the full file.
00000020d63872b76e1b69d756ee0856fe74fde833cf4968d04b3900000000000000000076cb2f126a6680329324844a0356af99111c3e8ce45fdad71c83850abd0537074d9e0a5b495a41178938eee4fd7f04010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff4503670108fabe6d6dcf3f8fa3f9f67db57c09b2a87b6116f3ec977211a39ce649f14c626e6e6274960100000000000000036507014d0fa1885d01008e300a2f736c7573682f0000000003e2552e4b000000001976a9147c154ed1dc59609e3d26abb2df2ea3d587cd8c4188ac00000000000000002c6a4c2952534b424c4f434b3a54129dce723400505ab51333431c504b3272a6203613c88a057150e0628e135d0000000000000000266a24aa21a9edfd0c8d457a5e85d6fe394a02074c0812467784561d5d117382ddddc814b2644c01200000000000000000000000000000000000000000000000000000000000000000000000000100000002e370c865451403fe21b4403ebf3e886d5a1d7d1cdd2ac19c3155b8a1f132d0a3010000006a4730440220256abe80fb0b613d4c1f6a555a697abd9b14194709888e0d46e9b8f3e1db49b10220057c7a58deee04c0581f3b5ae1434b675ca5d060934fffb68ae7b825f4820556012102ded4ea17bea78f9ae064ddadf7e33bc05e0f65f0667ac1