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 / receive-btc-cash-out-uk.md
Last active September 1, 2024 14:59
Receive bitcoin over lightning network and cash out to UK bank account

Receive bitcoin over lightning network and cash out to UK bank account

Project Outline

The providers listed below appear to be present in the UK.

Evaluate the services for receiving payment over lightning network, and cashing out to a UK bank account.

Document the steps and pitfalls.

@bretton
bretton / why-envoy-broken-freebsd.md
Last active August 11, 2024 15:20
Why is Envoy Proxy broken on FreeBSD?

Why is Envoy broken on FreeBSD?

Docker-style containers are live on FreeBSD via FreeBSD Container Images by Doug Rabson, also available at container registry quay.io/dougrabson

If you want to see how several containers work together, get started with the micropod-sampler playbook to setup a small consul, nomad, traefik, minio and nginx environment using FreeBSD containers on FreeBSD

When you see it working, it makes sense to expand the micropod-sampler environment to include Envoy Proxy.

There is a tutorial Envoy Consul Service Discovery Service which covers the basic concept using consul and nomad and envoy. You can also review the Hashicorp tutorial [Understanding Consul Connect](https://www.youtube.com

@bretton
bretton / repair-dude.md
Last active April 26, 2024 14:49
Repair Mikrotik Dude database

If you run a Mikrotik Dude instance on CHR, have a lot of devices and years of activity, problems start to arise with errors like:

server status: db failure: disk image is malformed. stop
server status: db failure: database disk image is malformed. stop

The problem might temporarily be resolved by running

#!/bin/bash
@bretton
bretton / self-hosted-ai.md
Last active January 5, 2024 11:05
Self-hosted AI toolsets

Self-hosted AI toolsets

TabbyML is a self-hosted AI coding assistant, offering an open-source and on-premises alternative to GitHub Copilot.

jan.ai is a self-hosted tool to run different LLMs. github releases

Apple's mlx is an array framework for machine learning on Apple silicon

AUTOMATIC1111's Stable Diffusion web UI is a browser interface for Stable Diffusion.

@bretton
bretton / haproxy-sni.md
Last active December 6, 2023 20:39
haproxy SNI configuration with SSL pass through

This comes from this forum post and adapted with info from this gist

A sample HAproxy configuration using SNI. Using SNI has the advantage that you don't have to mess with the certificates on the HAproxy server itself. Useful with many servers and / or many fast-expiring certificates (letsencrypt).

global
        maxconn         5000
        ulimit-n        16384
        log             127.0.0.1 local0
        uid             99
@bretton
bretton / apple-m2-qemu-libvirt.md
Last active September 10, 2023 21:50
Virtual machines on Apple M2 chips, with Ventura

Virtual machines on Apple M2 chips, with Ventura

Version

This is version 0.1

Requirements

I want to run VMs with custom networking over a bridge.

@bretton
bretton / unix-disk-usage-tools.md
Last active September 3, 2023 17:33
Unix Disk Usage Tools
@bretton
bretton / monthly-income-statement-gnucash.md
Created May 7, 2023 20:44
Create a month-by-month income statement in GnuCash

Create a month-by-month income statement in GnuCash

This works for Gnucash 4.12 on a Mac.

Reports > Multicolumn > Custom Multicolumn Report

Click the Options icon.

Set 12 columns.

@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