Skip to content

Instantly share code, notes, and snippets.


fiatjaf fiatjaf

View GitHub Profile
fiatjaf /
Created December 30, 2022 12:41
ActivityPub bridge Nostr relay bounty

ActivityPub bridge Nostr relay

tl;dr 5M sat bounty to make work.

The idea

ActivityPub communication is between servers. A server talks to another server, pushing and pulling data. Identities live on servers. Nostr communication is between clients and servers.

The idea of is to make a server that can act both as an ActivityPub server,

fiatjaf / benchmark_test.go
Created December 13, 2022 14:50
fetching a list of data from Redis with ZRANGE + GET benchmarks using 4 different methods
View benchmark_test.go
package main
import (
fiatjaf / results.txt
Created August 18, 2022 12:03
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
fiatjaf / f.lua
Last active January 19, 2022 23:46
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 September 14, 2021 00:25
exposing eclair to the world
View Caddyfile {
@whitelisted {
path /createinvoice
@blacklisted {
not path /createinvoice
reverse_proxy @whitelisted http://localhost:8877 {
fiatjaf /
Created June 27, 2021 19:39
Drivechain Checklist

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 17:27
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 January 9, 2021 01:16
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 December 25, 2020 22:08
RSKBLOCK merge mine scanner
View requirements.txt
fiatjaf / nSequence.bash
Last active December 18, 2020 12:29
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