Skip to content

Instantly share code, notes, and snippets.

View sgeisler's full-sized avatar

Sebastian sgeisler

View GitHub Profile
@sgeisler
sgeisler / assetsdir.sh
Last active September 19, 2020 14:58
Fetch the Liquid asset list and add the ticker labels to elements.conf
# 1. fetches asset registry JSON
# 2. extract ticker symbol and asset id
# 3. format it in the elements.conf format
# 4. deduplicate ticker symbols (apparently no uniqueness is enforced, beware that this operation is lossy)
# 5. append the labels to ~/.elements/elements.conf
curl https://assets.blockstream.info/ | jq -r '.[] | values | (.contract.ticker, .asset_id)' | xargs -n2 bash -c 'echo "assetdir=$1:$0"' | sort -t ':' -k '2' -u >> ~/.elements/elements.conf
// bitcoin = "*"
// bitcoin_hashes = "*"
use bitcoin::{Address, Network, Script};
use bitcoin::util::address::Payload;
use bitcoin::util::psbt::serialize::Deserialize;
use bitcoin_hashes::{hash160, Hash};
fn main() {
let bytes: &[u8] = &[
{
"peers": [
{
"id": "030c3f19d742ca294a55c00376b3b355c3c90d61c6b6b39554dbc7ac19b141c14f",
"connected": false,
"channels": [
{
"state": "ONCHAIN",
"scratch_txid": "5f0073427d083b8bc4830a75478e12715a338df97ce9cf25e4dd9900ab97dcf1",
"owner": "onchaind",
@sgeisler
sgeisler / gist:5a462edd7c5c9cdede84a97e8664ceb8
Created January 3, 2019 05:51
Benchmark of different hex decoding functions in rust
Running target/release/deps/from_hex-fc9ec3ff3f00540b
Gnuplot not found, disabling plotting
current decode 16 bytes time: [274.52 ns 275.15 ns 275.97 ns]
change: [-3.0724% -1.8371% -0.7138%] (p = 0.00 < 0.05)
Change within noise threshold.
Found 5 outliers among 100 measurements (5.00%)
5 (5.00%) high mild
optimized bytes decode 16 bytes
time: [49.239 ns 49.477 ns 49.769 ns]