Skip to content

Instantly share code, notes, and snippets.


fiatjaf fiatjaf

View GitHub Profile
fiatjaf / results.txt
Created Aug 18, 2022
Compiling a ScalaJS app with ESModule and CommonJSModule and sbt-esBuild
View results.txt
Results of transpiling and bundling a project that uses Laminar and handful of Scala libraries plus 4 reasonably-sized npm dependencies:
- fastLinkJS => 3.8MB
- fastLinkJS / esBuild => 4.1MB
- fullLinkJS => 3.6MB
- fullLinkJS / esBuild => 2.0MB
- fastLinkJS => 3.8MB
View f.lua
title = 'Free Tunnel Server'
description = [[
- Manages tunnel clients.
- Starts the LNbits main tunnel service.
This one is the free version, anyone can take a subdomain and keep it for free forever.
models = {
fiatjaf / Caddyfile
Created Sep 14, 2021
exposing eclair to the world
View Caddyfile {
@whitelisted {
path /createinvoice
@blacklisted {
not path /createinvoice
reverse_proxy @whitelisted http://localhost:8877 {

Drivechain Checklist

Check the boxes you understand and agree with. If you check more than 75% of the boxes you're a Drivechain maximalist. Otherwise you need treatment, join and ask for help.

  • Sidechains are chains independent of Bitcoin consensus. They don't add any burden to the Bitcoin full nodes.
  • Sidechains use bitcoins (BTC) as their base currency, not any shitcoin.
  • Sidechains can have different rules, implement different features, be developed by different teams.
  • Using a sidechain is completely optional.
  • Sidechains are expected to be blindly merge-mined with Bitcoin, which means they increase the Bitcoin security budget without adding any burden to the normal Bitcoin miners.
  • There are useful features that can be implemented in sidechains that we can't implement in Bitcoin today (and we don't want either, because it would clog the Bitcoin main chain which is already too small and want it to remain small).
fiatjaf /
Created May 24, 2021
establish a lightning connection to some node and get an `init` message back
# just copy and paste this somewhere changing the target node id, ip and address.
# you must have python3 and virtualenv, which can be installed with 'sudo apt install python3-virtualenv' on ubuntu
# it will download the pyln.proto library to a virtualenv and run the script below passed as a string
python3 -m venv venv
./venv/bin/pip install pyln.proto
./venv/bin/python -c '
import sys
from pyln.proto.wire import connect, PrivateKey, PublicKey
from binascii import unhexlify
fiatjaf /
Created Jan 9, 2021
Save all tweets from someone using (actually it's limited to 1800 I think)
import requests
username = 'alexberenson'
def write_tweets(f, tweets):
for tweet in tweets:
text = tweet["full_text"]
for url in tweet["entities"]["urls"]:
text = text.replace(url["url"], url["expanded_url"])
fiatjaf / requirements.txt
Created Dec 25, 2020
RSKBLOCK merge mine scanner
View requirements.txt
fiatjaf / nSequence.bash
Last active Dec 18, 2020
list all relative locktime usage across an interval of blocks
View nSequence.bash
for (( b=661000; b<=661884; b++ )) do
x=`bitcoin-cli getblock $(bitcoin-cli getblockhash $b) 2 | jq -c '.tx | map(select(.version > 1)) | map(.vin | map(.sequence | select((. < 2147483648) and (. > 0)))) | reduce .[] as $ns ([]; . + $ns) | reduce .[] as $n ({}; .["\($n)"] = (.["\($n)"] // 0) + 1)'`
if [ "$x" != '{}' ]
then echo $b: $x
fiatjaf / channels-balance-state.jq
Last active Aug 16, 2020
jq snippets for c-lightning
View channels-balance-state.jq
# use with:
# bash -c 'version=$(curl -s | jq -rc .history[0].version); curl -s$version/channels-balance-state.jq > /tmp/clsnippet.jq; lightning-cli listfunds | jq -f /tmp/clsnippet.jq'
# lightning-cli listfunds | jq '
| sort_by(.channel_sat) | reverse
| map
{ peer: .peer_id
, scid: .short_channel_id
fiatjaf / lightning-daemon-features
Last active Apr 4, 2020
lightning node versions
View lightning-daemon-features
c-lightning 0.6 88
c-lightning 0.6.1 8a
c-lightning 0.6.2 8a
c-lightning 0.6.3 88
c-lightning 0.7.0 8a
c-lightning 0.7.1 aa
c-lightning aa
c-lightning 0.7.3 28a2
c-lightning 0.8.0 02aaa2
c-lightning 0.8.1 02aaa2