Skip to content

Instantly share code, notes, and snippets.

@john-zaprite
john-zaprite / galoy_api_zaprite.md
Created April 13, 2022 17:24
Zaprite integration with the Galoy API.

The following is the ideal flow Zaprite would like to have when using the Galoy API.

API key

Zaprite should have it's own API key that we store as an environment variable in our Next JS app.

Permissions

1. Create public invoices on a user's behalf
2. Watch for settlement of those invoices
#!/bin/bash
#alias lightning-cli="docker exec -it cln lightning-cli"
#docker exec -it cln lightning-cli getinfo
#working_path=/home/bitcoin/script-earning
BASEDIR=$(dirname $0)
working_path=${BASEDIR}
_now=$(date +"%d:%m:%Y")
JSON=`docker exec cln lightning-cli clboss-status | jq .offchain_earnings_tracker`
echo $JSON | jq -r 'map({in_earnings, in_expenditures}) | (first | keys_unsorted) as $keys | map([to_entries[] | .value]) as $rows | $keys,$rows[] | @csv' > $working_path/status.csv
awk -F"," '{x+=$1}END{print "Total earning: " x/1000}' $working_path/status.csv
aahed
aalii
aargh
aarti
abaca
abaci
abacs
abaft
abaka
abamp
@freenancial
freenancial / xpub_zpub_convert.py
Created August 5, 2020 06:31
Convert xpub/xprv to zpub/zprv
import base58
x = 'xprv9s21ZrQH143K2f55zo5GiXiX16MiPzBgc2bEXNd77e1ooGsjxAyXjozyuniqiSB76VESjTW8s7vdsK3NFboha6tZgF9BzcDdNtUT6Aw99P2'
zp = b'\x04\xb2\x43\x0c'
base58.b58encode_check(zp + base58.b58decode_check(x)[4:]).decode('ascii')
# output: 'zprvAWgYBBk7JR8GjFTKfWeX8huXM2ecHEAgSFdg6AQssemZuUWCTVJeywKFxCe1iFUwumU4EQhFnSdjdtGVgzdjAaFmQvY3ARrbvLbjsLf6oNE'
# xprv = b'\x04\x88\xad\xe4'
# yprv = b'\x04\x9d\x78\x78'
# zprv = b'\x04\xb2\x43\x0c'
@OR13
OR13 / interop-links.md
Last active May 7, 2020 02:26
Interop Links
@darconeous
darconeous / tesla-key-card-protocol.md
Last active July 9, 2024 13:44
Tesla Key Card Protocol

Tesla Key Card Protocol

Researched by Robert Quattlebaum darco@deepdarc.com.

Last updated 2020-02-03.

Image of Tesla Key Card Image of Tesla Model 3 Key Fob

@alexcasalboni
alexcasalboni / aws-lambda-static-type-checker.md
Last active May 22, 2023 07:31
AWS Lambda Static Type Checker Example (Python3)

How to use Python3 Type Hints in AWS Lambda

TL;DR

Static Type Checkers help you find simple (but subtle) bugs in your Python code. Check out lambda_types.py and incrementally improve your code base and development/debugging experience with type hints.

Your Lambda Function code will go from this:

@pgolding
pgolding / scan.py
Created June 5, 2017 19:40
scan all elements from a dynamodb table using Python (boto3)
from __future__ import print_function # Python 2/3 compatibility
import boto3
import json
import decimal
from boto3.dynamodb.conditions import Key, Attr
# Helper class to convert a DynamoDB item to JSON.
class DecimalEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, decimal.Decimal):
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active July 19, 2024 22:35
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@kostaz
kostaz / Compile_Bitcoin_on_Ubuntu_14_04
Last active September 3, 2023 10:31
Compile Bitcoin on Ubuntu 14.04
Assuming the username of the Ubuntu user is "theusername".
Preparation
-----------
```
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev