Skip to content

Instantly share code, notes, and snippets.

View bretton's full-sized avatar

bretton bretton

  • Cape Town, South Africa
View GitHub Profile
@bretton
bretton / optimal-virtualbox-freebsd.md
Last active June 9, 2023 19:42
Optimal Virtualbox on FreeBSD, running FreeBSD virtual machines

Optimal Virtualbox on FreeBSD, running FreeBSD images

For best results:

  • Use only a single core per VM (cpus setting). This is critical, more causes problems.
  • Set the sysctl.conf settings below

Configure sysctl.conf and reboot

Add to /etc/sysctl.conf and reboot

@bretton
bretton / csv2json-onliner.md
Created April 12, 2023 09:44
Bash and python one-liner to convert CSV to JSON

Best method to convert CSV to JSON in bash one-liner

wget http://host/file.csv

# csv to json in python, requires a header row
cat file.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > file.json

cat file.json |jq
@bretton
bretton / import-letsencrypt-java.sh
Created February 17, 2023 17:02 — forked from galan/import-letsencrypt-java.sh
Imports the letsencrypt certificates into the java keystore
#!/bin/bash -e
# JAVA_HOME can be passed as argument if not set
if [ ! -d $JAVA_HOME ]; then
JAVA_HOME=${1}
fi
KEYSTORE=$JAVA_HOME/jre/lib/security/cacerts
if [ ! -f "$KEYSTORE" ]; then
echo "Keystore not found in '$KEYSTORE'"
exit 1
@bretton
bretton / self-determination-routing-node.md
Last active January 3, 2023 07:28
Self-Determination and Routing Capacity

Self-Determination and Routing Capacity

This has been observed in the wild. I'm not the originator, just documenting what I've seen.

Fund a node

You need a bitcoin and lightning network node.

You need to fund it with Bitcoin.

Open genesis channel

@bretton
bretton / ai-platforms-image-creation.md
Last active August 30, 2022 06:14
AI platforms for content and image generation
@bretton
bretton / hedged-ln-node.md
Last active June 21, 2022 21:07
Getting a 2:1 or greater risk-reward ratio on LN node and channels

Getting a 2:1 or greater risk-reward ratio on LN node and channels

WIP

Lets say a user wants to spin up a node with 0.1 btc, open a few channels, and generate routing fees.

How do they calculate a risk/reward ratio (RR) that makes economic sense?

What else can they do to improve the calculation, such as compartmentalising risk into discrete chunks which can be evaluated independently?

@bretton
bretton / getmagmaoffers.gql
Created June 15, 2022 07:28
Get Amboss Magma LN channel capacity offers API list
query GetMagmaOffers {
getOffers {
list {
account
amboss_fee_rate
base_fee
base_fee_cap
fee_rate
fee_rate_cap
id
@bretton
bretton / lndhub-providers.md
Last active June 5, 2022 21:10
List of lndhub providers
@bretton
bretton / washingtons-nft.md
Last active September 20, 2021 20:29
Washingtons NFT

Washingtons, NFT with staking.

Mint a Washington

  • Limit of 2 minted per wallet. Transfer out to mint more.
  • No limit to number that can be staked afaik.
  • Staked Washingtons get unstable dollars per day.

WIP, been a slow minting after launch. Seems like most high volume NFT launches involve buying their own tokens and artificial hype.

Rare traits

@bretton
bretton / changepass.php
Last active September 23, 2020 12:06
simple php form to change samba password
<?php
// original script from https://www.cyberciti.biz/tips/change-linux-or-unix-system-password-using-php-script.html
// adapted by Bretton 2020-09-22
//
// Requirements
// 1. webserver with https and php enabled
// 2. make sure you run visudo first and ensure it has
//
// www-data ALL=(ALL) NOPASSWD: /usr/bin/smbpasswd
//