Skip to content

Instantly share code, notes, and snippets.

View simonmichael's full-sized avatar

Simon Michael simonmichael

View GitHub Profile
@simonmichael
simonmichael / get-google-sheet-csv.hs
Created October 28, 2018 00:14
get-google-sheet-csv.hs - stack script to fetch google sheets as CSV
#!/usr/bin/env stack
{- stack --resolver=lts-9.21 script --compile
--package "bytestring cassava gogol gogol-core gogol-sheets lens pretty-show text"
--verbosity=info
-}
{-
INSTALL:
Get stack if needed, eg from https://haskell-lang.org/get-started
Run "get-google-sheet-csv.hs" once to compile. On Windows, run "stack get-googlesheet-csv.hs".
ledger-analytics$ git diff analyze.js
diff --git a/analyze.js b/analyze.js
index 09a98dd..34eefcd 100644
--- a/analyze.js
+++ b/analyze.js
@@ -2,7 +2,7 @@ const util = require('util')
const exec = util.promisify(require('child_process').exec)
module.exports.getCommodities = async (file) => {
- const { stdout } = await exec('ledger -f ' + file + ' commodities')
@simonmichael
simonmichael / all.journal
Created March 22, 2018 11:17
hledger: applying common account aliases to included files
alias /^income/ = revenues
include 2012.journal
include 2013.journal
end aliases
@simonmichael
simonmichael / Makefile
Created March 3, 2018 15:05
XpenseTracker -> hledger makefile
# XpenseTracker iOS app -> hledger import & reports
#
# Fetch csv files from XpenseTracker iphone app (requires curl, funzip).
# Procedure:
# connect phone and computer to same network
# make csv
# start XpenseTracker app
# enter each XpenseTracker log, as prompted on computer
# (first time: options, set appropriate CSV fields)
# options, export, export
@simonmichael
simonmichael / a.org
Created November 26, 2017 19:54
11/25 chat log comments

11/25 chat log comments

dev process

next time, we could set up a shared branch in main repo - simpler workflows, writable by all collaborators

agree with virkony that we could still group & collapse some related changes (not essential)

<virkony> sm: recently I’ve noticed that hledger repo have option “Create a merge commit” for pull-request disabled. Is that default settings or you configured that?

configured it, generally I like to have clean-ish rebased commits in master

github permissions - what can collaborators do, exactly - everything but change repo settings ?

period expressions

scope creep. improving/cleaning up period expressions is a big side quest

“every X” issues

old:
* Budgeting and forecasting document
* Show percentage of budget spent
* --budget switch for "balance"
* added --auto to balancemode, print, register
* added --forecast to balancemode, print, register
* Make runPeriodicTransaction stricter: it will reject period start days that do not line up with requested interval. This is very helpful for periodic transactions, because in budget mode you need to ensure that no periodic transactions extend past the end of the journal, and in forecast mode you need to make sure that all periodic transactions are strictly after the end of the journal.
* ensure that runPeriodicTransaction does not generate transactions outside of the requested DateSpan
* More AutoTransaction tests. Some of them demonstrate that runPeriodicTransaction could generate transactions ouside of requested DateSpan. This happens because runPeriodicTransaction uses splitSpan internally, and splitSpan always generates dateSpans that fully cover original DateSpan, extending beyound left/right boundar
@simonmichael
simonmichael / @simple.args
Created October 26, 2017 15:34
hledger args file for re-shaping chart of accounts etc.
--alias=/:(business|personal):/=:
--alias=/:(bank|cash|online):/=:
--alias=/:bofi:/=:b
--alias=/:unify:/=:u
--alias=/:wf:/=:w
cur:.
-2
@simonmichael
simonmichael / 20171012
Last active October 15, 2017 17:19
#ledger 2017/10 pricing/capital gains chat
[Thu Oct 12 2017]
<immae> Hey all! I'm facing a tricky situation with ledger: https://paste.ee/p/BNWVU Any hint?
[02:03]
@simonmichael
simonmichael / gist:d303bc30d2deb96519600afefdccc2e5
Last active September 28, 2017 17:20
syntax mockups for setting period budget targets
PERIOD ACCT AMT
PERIOD
ACCT1 AMT1
...
# setting time target for "admin" activities
2016y adm 240
2016q4 adm 60