Skip to content

Instantly share code, notes, and snippets.

@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
@solarkraft
solarkraft / syncthing-automerge.py
Created December 30, 2022 18:00
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™️).
import os
import time
import re
import subprocess
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
def get_relative_path(path):
return os.path.relpath(path)