Skip to content

Instantly share code, notes, and snippets.

@the-solipsist
the-solipsist / expense-accounts_coicop.journal
Created January 29, 2024 09:28
hledger account heirarchy based on COICOP 2018
; This chart of accounts is based on COICOP 2018.
; https://unstats.un.org/unsd/classifications/unsdclassifications/COICOP_2018_-_pre-edited_white_cover_version_-_2018-12-26.pdf
; While COICOP provides a "detailed" classification as well, going to 4-levels of depth,
; this is based on the "broad" classification, which goes to 2-levels of depth.
account Expenses:F&B
account Expenses:F&B:Food
account Expenses:F&B:Non-alcoholic-Beverages
account Expenses:F&B:Services
account Expenses:Alcohol&Narcotics
@the-solipsist
the-solipsist / notes_inline.lua
Created October 7, 2023 08:51
Convert Pandoc reference footnotes to inline footnotes
-- copied from https://groups.google.com/g/pandoc-discuss/c/_5-8TRJhhqo/m/xkbSBz2wAgAJ
-- pandoc --lua notes_inline.lua temp.md | sed -e 's/%%opening%%/ /g' | sed -e 's/%%closing%%//g'
function Note(note)
if #note.content == 1 then
table.insert(note.content[1].content, 1, pandoc.Str "%%opening%%")
table.insert(note.content[1].content, pandoc.Str "%%closing%%")
return note.content[1].content
@the-solipsist
the-solipsist / zotero-search-replace.js
Created September 10, 2023 20:41
Zotero search and replace javascript
// Adapted from
// https://forums.zotero.org/discussion/78501/possible-to-search-replace-a-character-in-all-titles
var s = new Zotero.Search();
s.libraryID = Zotero.Libraries.userLibraryID;
//s.addCondition('itemType', 'is', 'attachment');
// Add as many conditions as you like
s.addCondition('title', 'contains', 'Text to be replaced');
// get a list of valid fieldnames from https://api.zotero.org/itemFields?pprint=1
var ids = await s.search();
if (!ids.length) {
@the-solipsist
the-solipsist / watch-for-webpage-change-cron.sh
Created June 6, 2023 18:28 — forked from maxme/watch-for-webpage-change-cron.sh
Set this up in a crontab to check if a webpage changed since last check. It will email you the diff when it happens.
#!/bin/sh
checkIfPageChanged() {
URL="$1"
EMAIL_ADDRESS="$2"
CSS_SELECTOR="$3"
SILENT="$4"
tmpfile1=/tmp/$(echo $URL| sha1sum | cut -d" " -f1)
tmpfile2=$tmpfile1-1
curl -L --silent "$URL" -A "Maxme/1.0 (Watching for changes; https://gist.github.com/maxme/c31ffbb3cb21f3baa6e9c9e61bbe0a72)" \
@the-solipsist
the-solipsist / nps-transactions.rules
Last active November 29, 2022 10:36
hledger/plaintextaccounting importer for National Pension Scheme CSV files (downloaded from CRA-NSDL)
# skip the headings line:
skip 1
# use the following CSV fields:
fields date, desc, intermediary_charge, e_value, e_nav, e_units, c_value, c_nav, c_units, g_value, g_nav, g_units
# use the first date format if you have older CSV files
#date-format %d-%h-%y
date-format %d-%h-%Y
@the-solipsist
the-solipsist / hledger-update.sh
Created September 20, 2022 11:24
hledger-update
#!/bin/bash
cd $(dirname $0)
hledger --version
hledger-iadd --version
axel https://github.com/simonmichael/hledger/releases/download/$1/hledger-linux-x64.zip --output /tmp/hledger-linux-x64.zip # can rerun if interrupted
if [ $? -ne 0 ]; then
echo "not there"
else
axel https://github.com/hpdeifel/hledger-iadd/releases/download/v$2/hledger-iadd-$2-archlinux.tar.xz --output /tmp/hledger-iadd.tar.xz
oldversion=$(hledger --version | cut -d ' ' -f2 | cut -d',' -f1)
2019/07/01 Transfer Money to Maybank
Assets:Bank:Maybank USD 1,012.44
Equity:Trading:Currency:USD:SGD USD -1,012.44
Equity:Trading:Currency:SGD:USD $1,360.65
Assets:Bank:DBS:Savings $-1,360.65
2019/07/01 Maybank | Berkshire Hathaway
Assets:Stocks:Maybank:BerkshireHathaway 7.0000 BRKB
Equity:Trading:Stocks:BRKB:USD -7.0000 BRKB
Equity:Trading:Stocks:USD:BRKB USD 987.84
@the-solipsist
the-solipsist / donations_civil-liberties_india
Last active February 14, 2017 11:00
Donating to Civil Liberties Organizations in India
People's Union for Civil Liberties
==================================
PUCL doesn't take money from governments, foundations, political parties, corporations, etc.
It only takes money from individuals. It is organized into state chapters, which provide
donations to the national unit. However, one can also donate directly to the national,
and the details provided below are for that.
From the latest PUCL Bulletin:
"PUCL is a voluntary organisation which has only 2 full time staff at the national office
server {
listen 80;
server_name chat.cis-india.org;
return 301 https://$server_name$request_uri;
}
server {
listen 8020;
listen 443 ssl;
server_name chat.cis-india.org;
error_log /var/log/nginx/HOST_error.log;
#!/bin/sh
# automated retrieval of pipermail mbox file with full headers, if subscribed
# else, retrieval of pipermail mbox file with partial headers, if not subscribed
# https://mail.python.org/pipermail/mailman-users/2004-May/036948.html &
# https://mail.python.org/pipermail/mailman-users/2012-October/074208.html
#
# To use this script, simply run the following commands:
# $ wget https://gist.github.com/the-solipsist/a8a68e3bfcad9a0f8372/raw/get-mailman-archive.sh
# $ chmod +x get-mailman-archive.sh
# $ ./get-mailman-archive.sh