Skip to content

Instantly share code, notes, and snippets.

## This script echoes metrics pulled from borgbase API into a Prometheus agent friendly format
## jq is assumed installed
## Replace $API_KEY with a read only API key from your BrogBase account
## To use, set a cron job to write output of this script to a .prom file to be picked up by Prometheus agent
## Output format is as follows, repeated for each repo in account
## borg_repo_usage_mb_total{repo_name="<name>",repo_id="<id>"} <used space (mb):float>
## borg_repo_last_modified{repo_name="<name>",repo_id="<id>"} <timestamp (s):int)
## borg_repo_quota{repo_name="<name>",repo_id="<id>"} <quota size (mb):int>
@sazeygit
sazeygit / ulam.py
Last active February 6, 2023 18:33
Ulam spiral sketcher using NumPy and tkinter optimisations
from itertools import count, cycle
from math import ceil, sqrt
from numpy import arange, array, full, ones, insert, where
from numpy import append as ap
from time import perf_counter as pf
from time import sleep
from tkinter import Canvas, Tk, constants
root = Tk()
# root.attributes('-fullscreen', True) # make fullscreen window
@sazeygit
sazeygit / typer-example.py
Last active December 29, 2022 15:13
Display strings using a typing and a ticker effect. Typing effect can also be used to capture input.
import typer as t
def main(stdscr):
string = "Hello World!"
# Simple typing of a string
t.label(string)
# String on same line (default)
# Delay (ms) can be adjusted to your liking (default is 40ms)
t.label(string, delay=20, nl=0)