Skip to content

Instantly share code, notes, and snippets.

View bretton's full-sized avatar

bretton bretton

  • Cape Town, South Africa
View GitHub Profile
@tyzbit
tyzbit / Useful lncli aliases.md
Last active July 24, 2021 23:57
Useful commands/aliases for interacting with LND using lncli (https://github.com/lightningnetwork/lnd)

I am not responsible, directly or indirectly for the loss of funds using these commands. Use at your own risk.

Informational Commands

lrecv

Channels with received satoshis

alias lrecv="lncli listchannels | jq '[ .channels | .[] | select(.total_satoshis_received|tonumber>0) ]'"

loffchain

Channels with offchain transactions

@takinbo
takinbo / lnd-python-client.md
Created January 29, 2017 23:27
Writing a Python gRPC client for the Lightning Network Daemon

How to write a Python gRPC client for the Lightning Network Daemon

  • Create a virtual environment for your project
$ virtualenv lnd
  • Activate the virtual environment
$ source lnd/bin/activate
@vejuhust
vejuhust / Logger.py
Created February 27, 2017 15:41
Python Wrapper of SoftEtherVPN "vpncmd" Tool
#!/usr/bin/env python3
import logging
# Colorful console
RESET_SEQ = "\033[0m"
COLOR_SEQ = "\033[1;%dm"
BOLD_SEQ = "\033[1m"
@adrienemery
adrienemery / lightning_api.py
Last active October 26, 2019 07:34
LND "PayPI" (charge for api using lightning network)
"""
This app is an example of how you could charge for access to an API using
the lightning network and LND. The example uses a JWT token that grants 1-hour access
(the default jwt token expirey) but many different payment schemes could be
imagined (bulk payments/pay per call etc).
But for now I just wanted to show how simple it could be to add a paywall to an api service.
To use this api:
1. Make a POST request to get a new token and invoice at `/token`
@deviousway
deviousway / exim_cheatsheet.md
Created March 16, 2018 08:48
exim_cheatsheet

Here are some useful things to know for managing an Exim 4 server. This assumes a prior working knowledge of SMTP, MTAs, and a UNIX shell prompt.

Message-IDs and spool files The message-IDs that Exim uses to refer to messages in its queue are mixed-case alpha-numeric, and take the form of: XXXXXX-YYYYYY-ZZ. Most commands related to managing the queue and logging use these message-ids.

There are three -- count 'em, THREE -- files for each message in the spool directory. If you're dealing with these files by hand, instead of using the appropriate exim commands as detailed below, make sure you get them all, and don't leave Exim with remnants of messages in the queue. I used to mess directly with these files when I first started running Exim machines, but thanks to the utilities described below, I haven't needed to do that in many months.

Files in /var/spool/exim/msglog contain logging information for each message and are named the same as the message-id.

Files in /var/spool/exim/input are named after the mes

#!/bin/bash
# date,wallet_balance,channel_balance,total_capacity,remote_balance,unsettled_balance,sent_balance,received_balance,off_chain_updates,active_nodes,inactive_nodes,pending_channels,limbo_channels,pending_open,pending_close,pending_force_close
lncli="/home/lightning/gocode/bin/lncli"
file="~/lightning-monitor.csv"
# Date
newline="$(date +%s%3N)"
#set the separator to not be space
IFS=""
#!/bin/bash
#
# Prints out information from bitcoin-cli about the previous Bitcoin difficulty
# adjustment and the projected difficulty adjustment.
#
# Requires: bitcoin-cli
# jq
# bc
#