Skip to content

Instantly share code, notes, and snippets.

Simon Michael simonmichael

Block or report user

Report or block simonmichael

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@simonmichael
simonmichael / accounts.txt
Last active Apr 15, 2020
a sample *ledger chart of accounts (first 3 levels): combined personal & business, eg for a freelancer
View accounts.txt
assets
business
accounts receivable
bank
personal
accounts receivable
bank
cash
gifts
online
@simonmichael
simonmichael / Makefile
Last active Mar 26, 2020
cron job to autocommit journal & related files
View Makefile
# cron
# install ./crontab as the active crontab
cron-install:
@crontab ./crontab
# overwrite ./crontab with the active crontab
cron-sync:
@crontab -l >./crontab
@simonmichael
simonmichael / Close.md
Last active Jan 28, 2020
draft of new close doc
View Close.md

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 / average-cashflow.hs
Created Nov 29, 2012
hledger scripting exercise
View average-cashflow.hs
#!/usr/bin/env runhaskell
{-
Print monthly average cashflow by account.
$ average-cashflow.hs YEAR [JOURNALFILE]
-}
module Main where
@simonmichael
simonmichael / sm-Ledger.st
Created May 3, 2014
a prototype squeak port of Ledger, 2007
View sm-Ledger.st
"
prototype ledger file parser in squeak
Simon Michael
test scripts:
s1 := LedgerParserTests sample1 readStream
PositionableStream
2007/10/7 the fairmont sonoma mission inn & spa
expenses:food:dining $11
@simonmichael
simonmichael / a.bash
Last active Dec 4, 2019
scripts for finding available versions in nixpkgs
View a.bash
# Some nixpkgs query scripts inspired by #nixos chat.
# Goal: find the HASH that will let an install command like
# nix-env -i -f https://github.com/NixOS/nixpkgs/archive/HASH.tar.gz -A hledger hledger-web hledger-ui
# install the latest available build of the packages, on all platforms of interest.
# These scripts don't seem to quite do that but they help.
NIXARCHS="darwin linux"
HLEDGERPKGS="hledger hledger-ui hledger-web"
# show help for the following commands
@simonmichael
simonmichael / hledger-scripts.sh
Last active Nov 8, 2019
bash scripts for starting hledger(-ui) in various ways
View hledger-scripts.sh
# 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 / envelope-budgeting.journal
Last active Nov 1, 2019
envelope budgeting example
View envelope-budgeting.journal
; An example of YNAB-ish envelope budgetting with hledger/ledger
; cf https://github.com/simonmichael/hledger/issues/315
; Using accounts like the following:
;
; assets
; business
; bank
; wf
; bchecking
@simonmichael
simonmichael / README.md
Last active Oct 23, 2019
Build times of hledger dependencies on a slow machine
View README.md

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

@simonmichael
simonmichael / hledger-print-location.hs
Last active Oct 6, 2019
hledger script, prototyping print --location
View hledger-print-location.hs
#!/usr/bin/env stack
{- stack runghc --verbosity info
--package hledger-lib
--package hledger
--package here
--package text
-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
You can’t perform that action at this time.