Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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