Skip to content

Instantly share code, notes, and snippets.

@mbafford
mbafford / fix_payee_narration.py
Created November 30, 2021 12:23
Beancount - Fix payee/narration behavior to always have payee first and narration optional
#!python3
"""
Beancount has inconsistent behavior with payee/narrations.
If you have a line like this:
2020-01-01 * "Text1"
Then "Text1" is the narration
@mbafford
mbafford / dcu_opentimetable.py
Last active January 1, 2022 20:11
DCU OpenTimeTable module events scrapy code
import scrapy
import json
import scrapy.http
import re
import datetime
def build_weeks():
ret = []
for weekNo in range(16, 30):
week1 = datetime.date(2021, 9, 20)
@mbafford
mbafford / README.md
Created April 8, 2023 13:18
ruleswrapper for beancount-import

Rough guide to using my ruleswrapper.py class to hard-code certain rules in beancount-import.

See the example config - add the ruleswrapper as the data source, and specify the module to be wrapped as wrapped_module.

Any configuration parameters meant for the wrapped module should be added to the config passed to ruleswrapper.

Code may not compile exactly as-is - roughly edited to remove sensitive data.

TODO:

  • split rules into standalone file, so ruleswrapper.py can be shared more easily
@mbafford
mbafford / plaid_sync_source.py
Created February 19, 2024 11:55
plaid-sync sqlite Source for beancount-importer
"""
Meant to be used with:
https://github.com/mbafford/plaid-sync/
and:
https://github.com/jbms/beancount-import
Set up as a data source in your beancount-import config:
@mbafford
mbafford / README.md
Last active March 26, 2025 16:45
Compare two PDFs using ImageMagick - provides a visual comaprison and a perceptual hash comparison (numerical)

PDF tools for comparing PDFs visually (overlaying two PDFs to see changed areas) and using a perceptual hash (numerical value indicating visual difference between the two files).

Useful for command line review of PDFs and de-duplication. Configure git to use these tools for better PDF history / comparison in git.

These scripts require imagemagick and poppler. Both installed from homebrew.


Setup git to use a custom diff using:

@mbafford
mbafford / _fastmail-status-check.js
Last active November 10, 2024 13:48
Add Fastmail outages/incidents indicator to fastmail webUI (tampermonkey)
// ==UserScript==
// @name Fastmail Status Checker
// @namespace https://gist.github.com/mbafford/9fbfd4a4bb0c7f67b0910a9556bb65e2
// @version 1.2
// @description Show an icon on Fastmail indicating current service status from the status API.
// @author Matthew Bafford
// @match https://app.fastmail.com/*
// @grant none
// ==/UserScript==