Skip to content

Instantly share code, notes, and snippets.

@asciiphil
asciiphil / README.md
Created Oct 20, 2020
ZFS collectd plugin
View README.md

Put zfs.py into a directory (e.g. /opt/collectd-plugins). Load with, e.g.:

LoadPlugin python
<Plugin "python">
  ModulePath "/opt/collectd-plugins"
  Import "zfs"
</Plugin>
@asciiphil
asciiphil / 2-journal.beancount
Last active Apr 5, 2021
beancount litecoin example
View 2-journal.beancount
;;; semi-realistic example: buy and sell a couple of lots of LTC on exchange,
;;; tracking basis and gains explicitly.
;; You don't have to declare your commodity symbols, but you can if you
;; want to.
1792-04-02 commodity USD
name: "United States Dollar"
2011-10-07 commodity LTC
name: "Litecoin"
@asciiphil
asciiphil / 1-monopoly.py
Last active Jul 3, 2020
Code to generate Monopoly visualizations
View 1-monopoly.py
#!/usr/bin/env python3
import itertools
import colorcet as cc
import matplotlib.colors as mcolors
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
import numpy as np
@asciiphil
asciiphil / balance-sheet.sh
Last active Feb 14, 2020
Ledger Balance Sheet
View balance-sheet.sh
#!/bin/bash
DEPTH=2
LG="ledger -f main.ledger --force-color --depth=$DEPTH"
BALANCE_FORMAT="%(justify(scrub(display_total), 10, -1, true, color)) %(depth_spacer)%-(ansify_if(partial_account(options.flat), blue if color))\n%/%\$1\\n%/----------\\n"
$LG source </dev/null || exit 1
paste -d '|' \
<($LG --balance-format="$BALANCE_FORMAT" bal "$@" ^Assets) \
@asciiphil
asciiphil / 01 Raw Input
Last active Dec 23, 2019
Advent of Code 2019 Day 2 Intcode disassembly and analysis
View 01 Raw Input
"1,0,0,3,1,1,2,3,1,3,4,3,1,5,0,3,2,1,6,19,1,19,5,23,2,13,23,27,1,10,27,31,2,6,31,35,1,9,35,39,2,10,39,43,1,43,9,47,1,47,9,51,2,10,51,55,1,55,9,59,1,59,5,63,1,63,6,67,2,6,67,71,2,10,71,75,1,75,5,79,1,9,79,83,2,83,10,87,1,87,6,91,1,13,91,95,2,10,95,99,1,99,6,103,2,13,103,107,1,107,2,111,1,111,9,0,99,2,14,0,0"
View keybase.md

Keybase proof

I hereby claim:

  • I am asciiphil on github.
  • I am asciiphil (https://keybase.io/asciiphil) on keybase.
  • I have a public key ASCW6U3gAIhc5erYQtWALvg9PRU-kI7YIScI7CzJ4qwPpwo

To claim this, I am signing this object:

@asciiphil
asciiphil / weekday_alarm.toml
Created Apr 11, 2019
The morning alarm script I use with `oh-set-gradually`.
View weekday_alarm.toml
#### Normal use: start at 6:00 am
[rest]
host = "openhab.example.com"
port = 8080
[monitor]
item = "morning_alarm_running"
initialize = "ON"
stop_on = "OFF"
@asciiphil
asciiphil / tiber_river.geojson
Last active May 29, 2018
Watershed of the Tiber River
View tiber_river.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@asciiphil
asciiphil / well-heads.geojson
Last active May 22, 2017 — forked from anonymous/overpass.geojson
Well Heads for the Accident Natural Gas Storage Facility
View well-heads.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@asciiphil
asciiphil / primes.lisp
Last active Dec 5, 2016
Common Lisp prime testing
View primes.lisp
;;;; Needs the iterate package.
(defmacro maybep (&body body)
"Give this a series of forms. It will return the result of the first one that
yields T or NIL. Any other result will cause the next form to be evaluated.
Short-circuits like IF or COND."
(labels ((maybep-expand (forms)
(if (endp forms)
`(error "All evaluated forms yielded MAYBE.")
`(let ((result ,(car forms)))