Skip to content

Instantly share code, notes, and snippets.

@asciipip
asciipip / import.py
Created November 2, 2021 13:24
beancount-import example
#!/usr/bin/env python3
import glob
import os
import beancount_import.webserver
## I keep my scripts in a subdirectory relative to the main beancount
## file, so the main directory is this script's directory's parent.
JOURNAL_DIR = os.path.dirname(os.path.dirname(__file__))
@asciipip
asciipip / README.md
Last active February 20, 2022 17:53
ZFS collectd plugin

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>

Load zfs.json and zfs_arc.json into Grafana. They assume the data is saved in a Grafana dataset named collectd.

@asciipip
asciipip / 2-journal.beancount
Last active July 3, 2021 18:02
beancount litecoin example
;;; 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"
@asciipip
asciipip / 1-monopoly.py
Last active July 3, 2020 22:02
Code to generate Monopoly visualizations
#!/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
@asciipip
asciipip / balance-sheet.sh
Last active February 14, 2020 16:51
Ledger Balance Sheet
#!/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) \
@asciipip
asciipip / 01 Raw Input
Last active December 23, 2019 02:32
Advent of Code 2019 Day 2 Intcode disassembly and analysis
"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"

Keybase proof

I hereby claim:

  • I am asciipip on github.
  • I am asciiphil (https://keybase.io/asciiphil) on keybase.
  • I have a public key whose fingerprint is D200 5BDB FC4B B24A 9248 9F7A 4322 2D22 026A 27F2

To claim this, I am signing this object:

@asciipip
asciipip / weekday_alarm.toml
Created April 11, 2019 18:47
The morning alarm script I use with `oh-set-gradually`.
#### Normal use: start at 6:00 am
[rest]
host = "openhab.example.com"
port = 8080
[monitor]
item = "morning_alarm_running"
initialize = "ON"
stop_on = "OFF"
@asciipip
asciipip / tiber_river.geojson
Last active May 29, 2018 14:28
Watershed of the Tiber River
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@asciipip
asciipip / well-heads.geojson
Last active May 22, 2017 18:27 — forked from anonymous/overpass.geojson
Well Heads for the Accident Natural Gas Storage Facility
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.