Skip to content

Instantly share code, notes, and snippets.

@solarkraft
solarkraft / syncthing-automerge.py
Last active March 18, 2025 17:08
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",
@justind000
justind000 / helium-influx-bridge.py
Last active March 17, 2023 18:07
Helium - InfluxDB Bridge
import ssl, sys, json, base64
import paho.mqtt.client, msgpack, influxdb_client
from influxdb_client import InfluxDBClient, Point
from influxdb_client.client.write_api import SYNCHRONOUS
ufire_server = ""
mqtt_port = 8883
mqtt_username = ""
mqtt_password = ""
influx_bucket = ""
@sticilface
sticilface / PROGMEM.md
Last active July 23, 2023 11:38
PROGMEM

Guide to PROGMEM on ESP8266 and Arduino IDE

Intro

On low memory devices like the arduino and esp8266 you do not want strings to be stored in RAM. This occurs by default on these systems. Declare a string const char * xyz = "this is a string" and it will use up RAM.

The solution on these devices is to allow strings to be stored in read only memory, in Arduino this is the PROGMEM macro. Most of my experience is with the ESP8266 which is a 32bit micros controller. This device stores PROGMEM data in flash. The macro PROGMEM on ESP8266 is simply

#define PROGMEM   ICACHE_RODATA_ATTR