Skip to content

Instantly share code, notes, and snippets.

View bretton's full-sized avatar

bretton bretton

  • Cape Town, South Africa
View GitHub Profile
@patmaddox
patmaddox / mk_image.sh
Last active February 1, 2023 01:41
FreeBSD ZFS-on-Root (GCP)
#!/bin/sh
set -e
set -x
# Adapted from https://www.daemonology.net/blog/2019-02-16-FreeBSD-ZFS-AMIs-now-available.html
# Note: You need to run this on an instance with read/write access to Google Compute
# Alternatively, you can run the gcloud commands from somewhere with privileges
disk=da1
@ctsrc
ctsrc / README.md
Last active April 29, 2024 19:18 — forked from niw/README.en.md
Guide: Run FreeBSD 13.1-RELEASE for ARM64 in QEMU on Apple Silicon Mac (MacBook Pro M1, etc) with HVF acceleration (Hypervisor.framework)
@ecurrencyhodler
ecurrencyhodler / (Deprecated)LTC-Lightning-Network-lnd-Guide (Mac).md
Last active December 18, 2023 02:32
This is a step-by-step main net tutorial on how to setup a lightning network node for Litecoin on a Mac. It will take you from the beginning all the way through to becoming visible on a ln explorer. To send or recieve payments, refer to "Basic lnd Commands."

LTC-Lightning-Network-lnd-Guide

This is a step-by-step main net tutorial on how to setup a Lightning Network node for Litecoin on a Mac. It is specifically for the lnd client by the Lightning Labs. You can copy and paste most of the commands except for the times I've indicated in bold for you to input your own information. It would also be a good idea to backup your computer prior to starting just in case you need to start over.

Below is a legend. Refer to it as you come across terms or symbols you don’t understand. The first part of the tutorial is taken from the lnd github. However, everything else is written with the help of Patrick Walters taking me step by step through the process.

Legend

$ = This symbol means 1 line of code. Do not type “$” into your terminal. Simply input what follows then push enter.

Pubkey = Short for the public key that is generated from the private key w

@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

@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

#!/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
#
@lukassup
lukassup / zipapp.md
Last active September 12, 2023 02:17
Python zipapp

Python zipapp web apps

What's a zipapp?

This concept is very much like .jar or .war archives in Java.

NOTE: The built .pyz zipapp can run on both Python 2 & 3 but you can only build .pyz zipapps with Python 3.5 or later.

Initial setup