Skip to content

Instantly share code, notes, and snippets.

View simonmichael's full-sized avatar

Simon Michael simonmichael

View GitHub Profile
@simonmichael
simonmichael / finance.txt
Last active August 29, 2015 13:55
hledger register --width to avoid account name eliding
$ cat t.j
2014/01/01 This is some fun stuff
Expenses:BrigadoonChannel:Jebediah:Cheese $100.00
Expenses:BrigadoonChannel:Jebediah:Eastern&Western $100.00
Expenses:BrigadoonChannel:Jebediah:Tea&TeaImplements $100.00
Expenses:BrigadoonChannel:Jebediah:CandyBars $100.00
Expenses:BrigadoonChannel:Jebediah:Light&Dark $100.00
Liabilities:Payable:MagicTown $-500.00
$ hledger -f t.j reg
2014/01/01 This is some fun .. Ex:Br:Je:Cheese $100.00 $100.00
~/personal$ hledger -f t.j reg Tea
2014/01/01 This is some fun .. ..:Tea&TeaImplements $100.00 $100.00
~/personal$ hledger -f t.j reg Tea -w150
2014/01/01 This is some fun stuff Expenses:BrigadoonChannel:Jebediah:Tea&TeaImplements $100.00 $100.00
import Control.Applicative ((<$>))
import Control.Concurrent (forkIO)
import Control.Concurrent.MVar (newEmptyMVar, putMVar,
takeMVar)
import Control.Monad (liftM, unless, when)
import Data.Algorithm.Diff
import Data.List
import Data.Maybe (catMaybes, fromJust,
isJust, isNothing)
import Debug.Trace
@simonmichael
simonmichael / hledger-rewrite.hs
Last active August 29, 2015 13:56
hledger-rewrite sketch
#!/usr/bin/env runhaskell
{-|
hledger-rewrite PATTERNS --add-posting "ACCT AMTEXPR" ...
Skeleton for a minimal generic rewriter of journal entries.
Reads the default journal and prints the entries, like print,
but adds the specified postings to any entries matching PATTERNS.
|-}
# sample of CSV being converted
#Date, Time, Time Zone, Name, Type, Status, Currency, Amount, Receipt ID, Balance,
#"7/20/2009","17:09:22","PDT","Skype","Preapproved Payment Sent","Completed","USD","-10.00","","0.00",
# skip the header line
skip 1
# name the csv fields, and assign some of them as entry fields
fields date, time, timezone, description, type, status, currency, grossamount, feeamount, netamount, fromemail, toemail, code, counterpartystatus, etc
@simonmichael
simonmichael / Settings.hs
Created February 19, 2014 18:56
darcs hub settings excerpt
-- hub.darcs.net settings:
-- optional features
multiuser = True -- Enable user registration ?
issuetrackers = True -- Enable optional issue trackers ?
deletefiles = True -- Delete repos from the filesystem when deleted in the web UI ?
-- app url
baseUrl = "http://" ++ hostname ++ basePort ++ basePath
hostname = "hub.darcs.net"
@simonmichael
simonmichael / supervisord.conf
Created March 27, 2014 14:56
example supervisord config for running rss2irc
[program:rss2irc-hackagebot]
command=/usr/local/bin/rss2irc --debug-feed --debug-irc -i5 http://hackage.haskell.org/recent.rss irc.freenode.net/haskell/hackagebot --description --html --replace '<i>Added by (\w*).*<\/i>(?:<p>)?(.*)/\2 (\1)' --ident 'hackage upload announce bot, owner: sm' --use-actions -$
priority=5
redirect_stderr=true
autostart=true
autorestart=true
startretries=0
startsecs=2
environment=LANG=en_US.UTF-8
$ cabal install hledger-web-0.22.4 --dry
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: hledger-web-0.22.4 (user goal)
trying: yesod-static-1.2.2.5 (dependency of hledger-web-0.22.4)
trying: wai-app-static-2.0.1 (dependency of yesod-static-1.2.2.5)
trying: yesod-1.2.5.2 (dependency of hledger-web-0.22.4)
trying: yesod-auth-1.3.0.4 (dependency of yesod-1.2.5.2)
trying: authenticate-1.3.2.8 (dependency of yesod-auth-1.3.0.4)
trying: tagstream-conduit-0.5.5.1 (dependency of authenticate-1.3.2.8)
$ cabal install ~/src/hledger/hledger-web --dry
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: hledger-web-0.22.98 (user goal)
trying: hledger-web-0.22.98:-blaze_html_0_4
trying: blaze-markup-0.6.0.0 (dependency of
hledger-web-0.22.98:-blaze_html_0_4)
trying: yesod-static-1.2.2.5 (dependency of hledger-web-0.22.98)
trying: unordered-containers-0.2.4.0 (dependency of yesod-static-1.2.2.5)
trying: hashable-1.2.1.0 (dependency of unordered-containers-0.2.4.0)
@simonmichael
simonmichael / keybase.md
Created April 20, 2014 17:21
keybase.md

Keybase proof

I hereby claim:

  • I am simonmichael on github.
  • I am simonmichael (https://keybase.io/simonmichael) on keybase.
  • I have a public key whose fingerprint is E78A 85A8 9696 FABE 7ED1 CAE6 9ED5 BEB2 E43A B4B4

To claim this, I am signing this object: