Skip to content

Instantly share code, notes, and snippets.

View simonmichael's full-sized avatar

Simon Michael simonmichael

View GitHub Profile
@simonmichael
simonmichael / Caddyfile
Last active April 27, 2021 23:09
caddy 2 configs, WIP
# https://caddyserver.com/docs/caddyfile/options
{
email webmaster@joyful.com
}
# import everything in this directory beginning with a lowercase letter (not this file, dot files, or autosave files)
# import [a-z]*
# can't do it with caddy 2 ?
#import *
import hledger.org
@simonmichael
simonmichael / Balance.md
Last active March 5, 2021 17:25
draft of balance report types doc

For simonmichael/hledger#1496

Balance report types

For more flexible reporting, there are three important option groups:

hledger balance [CALCULATIONTYPE] [ACCUMULATIONTYPE] [VALUATIONTYPE] ...

The first two are the most important: calculation type selects the basic calculation to perform for each table cell, while

@simonmichael
simonmichael / buy-and-sell-btc-adjusting-basis-on-both.journal
Last active March 3, 2021 00:31
hledger entries for adjusting cost basis of investments
comment
Journal entries describing a stock or cryptocurrency purchase and
sale, with cost basis adjustments to account for fees. In this
example, even though selling at a higher price, the high fees
turn the gain into a loss.
This is just one way to record these; I have tried to split
out the parts for clarity. Opening and closing transactions
and some reports have been added to show the results and
@simonmichael
simonmichael / symlinkghc
Last active March 1, 2021 14:18
symlinkghc - Symbolically link the ghc tools provided by the global stack resolver into PATH
#!/bin/sh
# Usage: symlinkghc
# Symbolically link the ghc tools provided by the global stack resolver
# (ghc ghci runghc runhaskell ghc-pkg haddock hp2ps hpc hsc2hs,
# ~/.stack/global-project/stack.yaml)
# into ~/.local/bin, so that they are always available at the command
# line for quick experiments. ~/.local/bin should be in your PATH.
# Similarly named executables/links in that directory will be overwritten.
# GHC will be downloaded if needed, eg if you just updated the global stack resolver.
# Caveat: these will see only the ghc package db by default, not new packages you have installed.
@simonmichael
simonmichael / .emacs
Last active February 9, 2024 14:05
Emacs org-capture template for hledger/ledger/PTA transactions
(setq org-capture-templates '(
;...
("t" "h/ledger transaction" plain
(file "~/finance/2020.journal")
"%(org-read-date) %^{Description}
%^{Category|expenses:food:groceries|expenses:food:dining|expenses:transport:gasoline|expenses:home|expenses:medical|expenses:entertainment|revenues:consulting|revenues:misc} %^{Amount}
%^{Asset/liability account|assets:cash|assets:bank:checking|liabilities:bank:credit card}"
:empty-lines 1)
))
@simonmichael
simonmichael / 10000x10000x10.journal
Created July 1, 2020 03:02
10,000-transaction journal file
This file has been truncated, but you can view the full file.
2000-01-01 transaction 1
1 1 A
1:2 -1 A
2000-01-02 transaction 2
1:2:3 2 A
1:2:3:4 -2 A
2000-01-03 transaction 3
1:2:3:4:5 3 A
@simonmichael
simonmichael / Close.md
Last active January 28, 2020 01:08
draft of new close doc

close, equity
Adds a "closing balances" transaction to the main journal file, that brings selected account balances to zero. Also (by default), adds the inverse "opening balances" transaction to a new journal file (creating it if necessary), restoring those account balances as they were in the old journal.

This can be used to bring asset/liability balances forward into a new journal file, or to close out revenues/expenses to retained earnings at the end of an accounting period. More on this below.

@simonmichael
simonmichael / Makefile
Last active March 26, 2020 17:13
cron job to autocommit journal & related files
# cron
# install ./crontab as the active crontab
cron-install:
@crontab ./crontab
# overwrite ./crontab with the active crontab
cron-sync:
@crontab -l >./crontab
@simonmichael
simonmichael / hledger-scripts.sh
Last active November 8, 2019 20:18
bash scripts for starting hledger(-ui) in various ways
# short aliases for hledger commands
alias h='hledger'
alias acc='hledger accounts'
alias act='hledger activity'
alias add='hledger add'
alias bal='hledger balance'
alias close='hledger close'
alias iadd='hledger-iadd --date-format %Y/%m/%d'
alias print='hledger print'
alias reg='hledger register'
@simonmichael
simonmichael / README.md
Last active October 23, 2019 17:50
Build times of hledger dependencies on a slow machine

Build times in minutes of hledger's dependencies, running cabal and ghc 8.4.4 with a single Cortex-A53 CPU and 4G RAM, emulated on some faster machine.

From xiroux on #hledger:

sm: If you wanna take a look at the times, I just listed the files in .cabal-sandbox/lib/ with their last modification time and computed how much time passed between one file and another. The data is here: https://hastebin.com/egexogarek