Skip to content

Instantly share code, notes, and snippets.

diff --git a/src/main.c b/src/main.c
index b4dbf9e0..51a73e6d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -41,6 +41,7 @@ static gboolean opt_no_sigint = FALSE;
static gboolean opt_disable_modules = FALSE;
static gboolean opt_force_load_modules = FALSE;
static gboolean opt_uninstalled = FALSE;
+extern gint opt_housekeeping;
static GOptionEntry opt_entries[] =
@petermolnar
petermolnar / glow-smets2-cad-mqtt-autodiscovery.py
Created November 2, 2022 16:28
domoticz and home assistant MQTT auto-discovery kickoff for local MQTT from Glow SMETS2 CAD
import paho.mqtt.client as mqtt
import json
client = mqtt.Client()
# set the mqtt user and password if you have to
client.username_pw_set(
username="your mqtt user", password="your mqtt password"
)
# set the host and the port if you have to
import paho.mqtt.client as mqtt
import json
import requests
def on_connect(client, userdata, flags, rc):
print(f"Connected with result code {rc}")
client.subscribe("#")
def on_message(client, userdata, msg):
@petermolnar
petermolnar / integromat-rss.json
Created January 5, 2021 10:40
Peter's Integromat RSS feed syndication
{
"name": "syndicate my RSS feed",
"flow": [
{
"id": 1,
"module": "rss:TriggerNewArticle",
"version": 4,
"parameters": {
"url": "https://petermolnar.net/feed/index.xml",
"gzip": true,
@petermolnar
petermolnar / prosody.cfg.lua (partial)
Last active December 31, 2020 17:09
TURN, STUN, prosody
modules_enabled = {
-- lots of modules here, add:
"turncredentials";
}
-- before virtualhosts
turncredentials_secret = "[SECRET STRING]";
turncredentials_host = "xmpp.petermolnar.net"
@petermolnar
petermolnar / 404.json
Last active December 29, 2020 14:40
petermolnar.net redirects, rewrites, gones, etc.
{
"bad_request": [
".*%22https?:.*",
"^/xmlrpc\\.php$",
"^.*\\.pHp5$",
"^.*\\.phtml$",
"^/_timthumb_.*$",
"^.*?flattrss_redirect.*$",
"^.*/None",
"…"
@petermolnar
petermolnar / image.initmeta.sh
Last active September 3, 2020 21:09
set image license and right metadata to please Google
#!/bin/bash
if [ -z "$1" ]; then
echo "Use: image.initmeta PHOTO"
exit 1
fi
year="$(exiftool -s -EXIF:DateTimeOriginal "$1" | awk '{print $3}' | cut -d":" -f1)"
artist="Peter Molnar"
rights="CC BY-NC-ND 4.0 ${year} ${artist} <mail@petermolnar.net>"
@petermolnar
petermolnar / wallabag2epub.sh
Created August 5, 2019 11:20
exporting entries from wallabag
#!/usr/bin/env bash
# script needs env vars passed, needs to be called as:
# WALLABAG_ID='client_id' WALLABAG_SECRET='client_secret' WALLABAG_USERNAME='username' WALLABAG_PASSWORD='password' WALLABAG_URL='url' bash wallabag2epub.sh
# requires `jq` https://stedolan.github.io/jq/ because nobody should deal with parsing json with sed
function err {
>&2 echo $1
}
@petermolnar
petermolnar / gist:b5bd11d202ca0eec68a28d39c89b1004
Created May 22, 2019 14:04
extremely simple vanilla js lightbox
var links2img = []
function initLightbox() {
var links = document.getElementsByTagName("a");
for(var i = links.length; i--; ) {
var imginside = links[i].getElementsByTagName("img");
if (imginside.length == 1 ) {
links2img.push(links[i])
console.log(links[i]);
links[i].onclick = openLightbox;
@petermolnar
petermolnar / facebook2wordpress.py
Last active February 22, 2019 10:57
facebook json export to wp-cli import bash
import json
import arrow
import os
import logging
from shlex import quote
from pprint import pprint
base = '/web/blog.pakuauk.com/exports/facebook-export'
with open('facebook-export/posts/posts.json', 'rt') as f: