Skip to content

Instantly share code, notes, and snippets.

View jonasnick's full-sized avatar

Jonas Nick jonasnick

View GitHub Profile
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p git gnupg curl
set -euo pipefail
TMPDIR="$(mktemp -d -p /tmp)"
trap "rm -rf $TMPDIR" EXIT
cd $TMPDIR
echo "Fetching latest release"
git clone https://github.com/elementsproject/elements 2> /dev/null
@jonasnick
jonasnick / taproot_test.c
Last active March 28, 2020 08:56
Taproot Test
/*********************/
/* Current version */
/* */
/*********************/
/* Create output key */
secp256k1_rand256(sk);
CHECK(secp256k1_xonly_pubkey_create(ctx, &internal_pk, sk) == 1);
/* In actual taproot the tweak would be hash of internal_pk */
CHECK(secp256k1_xonly_pubkey_serialize(ctx, tweak, &internal_pk) == 1);
# bitcoin-cli wrapper for running c-lightning with a pruned Bitcoin node
# (EXPERIMENTAL). It forwards all requests to bitcoind. If a getblock request fails,
# blockstream.info is queried instead. If your prune setting is high enough (2 weeks
# = 2016?) using this wrapper SHOULDN'T have security implications because the
# important blocks are still queried through your own bitcoind.
# Tested with c-lightning 0.6.2. Set the --bitcoin-cli=PATH option in c-lightning to
# the path of this file to use it.
BCLI=bitcoin-cli
getblock() {
@jonasnick
jonasnick / Makefile
Created November 23, 2016 18:08
secp lcov
main main.gcno: main.c
gcc --coverage -O0 -o main main.c -I../secp256k1/include
main.gcda: main
./main
main.c.gcov: main.gcda
gcov main
coverage.info: main.c.gcov
@jonasnick
jonasnick / gist:105092f5ad81c9787a3f
Created February 6, 2016 19:43
identity statement
g6Rib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEgaxWcsVQJ2ThIpV5KbmxzG9UueIUhS/kjIK0vRl/dj7MKp3BheWxvYWTFAup7ImJvZHkiOnsia2V5Ijp7ImVsZGVzdF9raWQiOiIwMTAxNzc5NTQxZmY0YWFkOGIwMGUzMDNhZjk2ZmY1MTVhMDJkN2QxNDhiZDQwMGY3NjI4NmFlM2ZmMjU1OWQ4NDJiZjBhIiwiaG9zdCI6ImtleWJhc2UuaW8iLCJraWQiOiIwMTIwNmIxNTljYjE1NDA5ZDkzODQ4YTU1ZTRhNmU2YzczMWJkNTJlNzg4NTIxNGJmOTIzMjBhZDJmNDY1ZmRkOGZiMzBhIiwidWlkIjoiYzRhNDUxZGFjNzdmYWE4YTM5ZGUwYmE3YTkyMDg1MTkiLCJ1c2VybmFtZSI6ImpuaWNrIn0sInNlcnZpY2UiOnsibmFtZSI6ImdpdGh1YiIsInVzZXJuYW1lIjoiam9uYXNuaWNrIn0sInR5cGUiOiJ3ZWJfc2VydmljZV9iaW5kaW5nIiwidmVyc2lvbiI6MX0sImNsaWVudCI6eyJuYW1lIjoia2V5YmFzZS5pbyBnbyBjbGllbnQiLCJ2ZXJzaW9uIjoiMS4wLjEwIn0sImN0aW1lIjoxNDU0Nzg3NzQ1LCJleHBpcmVfaW4iOjUwNDU3NjAwMCwibWVya2xlX3Jvb3QiOnsiY3RpbWUiOjE0NTQ3ODc2NTUsImhhc2giOiI0ZDA3NDA1YTQ4MzNlNzIwMWJjZjRiNjQzMDkxZjRjMDYzMDQ2ZTdjNWI2YTYzODg0MmI4YWMyNTMyZDMzYWQxOGFkNDkzZjc0YWViNzQ5OTdhNDEzMjYzNDE5MDk2MjdkMmU4ZDViNWRmMDFlNWE4MmY3YjRlYzliMGE5NzFlOCIsInNlcW5vIjozNzM0MjV9LCJwcmV2IjoiN2I0ODQ1MGUyNjY3OTYwYjcyYzcxMWEzY2I2OGI1OWE0MTcx
From ca9c781a458818f505b11c566d1bdd9c41dd9ab9 Mon Sep 17 00:00:00 2001
From: jonasnick <jonasd.nick@gmail.com>
Date: Sun, 4 May 2014 23:19:37 +0200
Subject: [PATCH] Fixes infinite hello request/reply messages in networks with
>2 nodes.
---
node/crypto2crypto.py | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
#!/bin/sh
# sends every input character to the specified screen
screen_name=t1
while read -r char
do
screen -S $screen_name -X stuff "$char"
done
@Test
public void testDelete() {
StorageRootInMemory storage = new StorageRootInMemory(ZooConfig.getFilePageSize());
StorageChannelOutput out = storage.getWriter(false);
int pageId = out.allocateAndSeek(DATA_TYPE.GENERIC_INDEX, 0);
out.writeShort((short) -1);
out.flush();
assertEquals(2, storage.statsGetPageCount());
@jonasnick
jonasnick / bca.php
Last active October 17, 2022 20:36
Blog Comments in Activity (bca) Shows blog post comments in buddypress' activity stream. Does currently not keep track of editing or removing comments.
<?php
/*
* Blog Comments in Buddypress Activity
* WARNING: Test thoroughly if it works in your environment before using in production code.
* LICENSE: Public domain
*/
/*
* When a new comment gets added to the database, add this comment to the