Skip to content

Instantly share code, notes, and snippets.

View simonmichael's full-sized avatar

Simon Michael simonmichael

View GitHub Profile
@simonmichael
simonmichael / gist:65acc7dffb060a6d21636d83f5a7013e
Created September 13, 2017 01:29
hledger commands list 2017/9/12
$ hledger
Commands available (41):
Standard reports:
accounts show chart of accounts
balancesheet (bs) show a balance sheet
balancesheetequity (bse) show a balance sheet with equity
cashflow (cf) show a cashflow statement
incomestatement (is) show an income statement
$ cabal install ./hledger-api --dry
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: ansi-terminal-0.7 (dependency of wai-extra-3.0.20.0)
trying: optparse-applicative-0.14.0.0 (dependency of wai-app-static-3.1.6.1)
next goal: ansi-wl-pprint (dependency of optparse-applicative-0.14.0.0)
rejecting: ansi-wl-pprint-0.6.8.1, ansi-wl-pprint-0.6.8,
ansi-wl-pprint-0.6.7.3, ansi-wl-pprint-0.6.7.2, ansi-wl-pprint-0.6.7.1,
ansi-wl-pprint-0.6.7, ansi-wl-pprint-0.6.6 (conflict: ansi-terminal==0.7,
ansi-wl-pprint => ansi-terminal>=0.4.0 && <0.7)
@simonmichael
simonmichael / hledger-import.hs
Created August 21, 2017 21:14
hledger-import WIP
#!/usr/bin/env stack
{- stack runghc --verbosity info
--package hledger-lib
--package hledger
--package here
--package megaparsec
--package text
--package Diff
-}
:tests/csv/csv-read.test:1: [Failed]
Expected stdout:
2009/09/10 Flubber Co
income:unknown $-50
assets:myacct $50
Got stdout:
2009/09/10 Flubber Co
@simonmichael
simonmichael / estimated-tax.journal
Last active August 6, 2017 15:13
tracking estimated tax while receiving payment
2017/8/8 () client1 | receive payment
; Externally, this is just a cheque deposit. In my accounts, all of the following happens:
;
; decrease client receivable. Unbalanced because using cash basis accounting which does not track invoices.
(assets:business:receivable:client1:consulting) $-1100
;
; receive reimbursement/prepayment for expenses. This is not revenue.
assets:business:receivable:client1:expenses $-100
assets:business:bank:checking $100
;
@simonmichael
simonmichael / DocFIles.hs
Created July 7, 2017 14:16
running an interactive pager
runPagerForTopic :: FilePath -> Topic -> IO ()
runPagerForTopic exe t = do
(Just inp, _, _, ph) <- createProcess (proc exe []){
std_in=CreatePipe
}
hPutStrLn inp (lookupDocTxt t)
_ <- waitForProcess ph
return ()
[9 of 9] Compiling SSH ( src/SSH.hs, .stack-work/dist/i386-linux/Cabal-1.24.2.0/build/SSH.o )
/home/simon/src/ssh_darcshub/src/SSH.hs:12:1: warning: [-Wunused-imports]
The import of ‘CryptoRandomGen, genBytes, genSeedLength’
from module ‘Crypto.Random’ is redundant
/home/simon/src/ssh_darcshub/src/SSH.hs:13:1: warning: [-Wunused-impor
@simonmichael
simonmichael / onelinecsv.hs
Last active July 1, 2017 10:52
one line csv script
#!/usr/bin/env stack
{- stack runghc
--package hledger-lib
--package text
-}
import Control.Monad
import qualified Data.Text as T
import Data.List
import Data.Text (pack,unpack)
@simonmichael
simonmichael / hledger-get-crypto-prices.hs
Last active June 12, 2017 01:10
hledger-get-crypto-prices json fetcher prototype
#!/usr/bin/env stack
{- stack runghc --verbosity info
--package hledger-lib
--package hledger
--package here
--package aeson
--package http-conduit
--package conduit-extra
--package decimal
--package text
@simonmichael
simonmichael / a.json
Last active June 12, 2017 00:17
prices json
{
"BTC": {
"USD": 2956.8899999999999
},
"ETH": {
"USD": 343.82999999999998
},
"LTC": {
"USD": 33.289999999999999
}