Skip to content

Instantly share code, notes, and snippets.

View MvRens's full-sized avatar

Mark van Renswoude MvRens

  • Netherlands
View GitHub Profile
@Didgeridrew
Didgeridrew / numerals.jinja
Last active July 13, 2025 08:31
HA- Macro to convert text numbers to integers
{%- macro _int_parser(text) -%}
{%- set num_names = {
'zero': 0, 'one': 1, 'two': 2, 'three': 3,
'four': 4, 'five': 5, 'six': 6, 'seven': 7,
'eight': 8, 'nine': 9, 'ten': 10, 'eleven': 11,
'twelve': 12, 'thirteen': 13, 'fourteen': 14, 'fifteen': 15,
'sixteen': 16, 'seventeen': 17, 'eighteen': 18, 'nineteen': 19,
'twenty': 20, 'thirty': 30, 'forty': 40, 'fifty': 50,
'sixty': 60, 'seventy': 70, 'eighty': 80, 'ninety': 90} -%}
@solarkraft
solarkraft / syncthing-automerge.py
Last active December 27, 2025 02:28
Monitors a Syncthing-synced directory and tries to merge conflicting files (based on https://www.rafa.ee/articles/resolve-syncthing-conflicts-using-three-way-merge/). Probably adaptable for other directory types, but only tested with Logseq (works for me™️).
# This script automatically handles Syncthing conflicts on text files by applying a
# git three-way merge between the previously synced version and each divergent version.
# It depends on the watchdog package and git.
# For automatic dependency installation when running with ´uv run --script deconflicter.py´:
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "watchdog",