Skip to content

Instantly share code, notes, and snippets.

View bretton's full-sized avatar

bretton bretton

  • Cape Town, South Africa
View GitHub Profile
@bretton
bretton / apple-m2-qemu-libvirt.md
Last active September 10, 2023 21:50
Virtual machines on Apple M2 chips, with Ventura
View apple-m2-qemu-libvirt.md
@bretton
bretton / monthly-income-statement-gnucash.md
Created May 7, 2023 20:44
Create a month-by-month income statement in GnuCash
View monthly-income-statement-gnucash.md
@bretton
bretton / optimal-virtualbox-freebsd.md
Last active June 9, 2023 19:42
Optimal Virtualbox on FreeBSD, running FreeBSD virtual machines
View optimal-virtualbox-freebsd.md
@bretton
bretton / csv2json-onliner.md
Created April 12, 2023 09:44
Bash and python one-liner to convert CSV to JSON
View csv2json-onliner.md

Best method to convert CSV to JSON in bash one-liner

wget http://host/file.csv

# csv to json in python, requires a header row
cat file.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > file.json

cat file.json |jq
@bretton
bretton / import-letsencrypt-java.sh
Created February 17, 2023 17:02 — forked from galan/import-letsencrypt-java.sh
Imports the letsencrypt certificates into the java keystore
View import-letsencrypt-java.sh
#!/bin/bash -e
# JAVA_HOME can be passed as argument if not set
if [ ! -d $JAVA_HOME ]; then
JAVA_HOME=${1}
fi
KEYSTORE=$JAVA_HOME/jre/lib/security/cacerts
if [ ! -f "$KEYSTORE" ]; then
echo "Keystore not found in '$KEYSTORE'"
exit 1
@bretton
bretton / self-determination-routing-node.md
Last active January 3, 2023 07:28
Self-Determination and Routing Capacity
View self-determination-routing-node.md
@bretton
bretton / hedged-ln-node.md
Last active June 21, 2022 21:07
Getting a 2:1 or greater risk-reward ratio on LN node and channels
View hedged-ln-node.md

Getting a 2:1 or greater risk-reward ratio on LN node and channels

WIP

Lets say a user wants to spin up a node with 0.1 btc, open a few channels, and generate routing fees.

How do they calculate a risk/reward ratio (RR) that makes economic sense?

What else can they do to improve the calculation, such as compartmentalising risk into discrete chunks which can be evaluated independently?

@bretton
bretton / getmagmaoffers.gql
Created June 15, 2022 07:28
Get Amboss Magma LN channel capacity offers API list
View getmagmaoffers.gql
query GetMagmaOffers {
getOffers {
list {
account
amboss_fee_rate
base_fee
base_fee_cap
fee_rate
fee_rate_cap
id