Skip to content

Instantly share code, notes, and snippets.

@petermolnar
petermolnar / themeswitcher.css
Last active December 11, 2023 13:06
automatic (prefers-color-scheme) and manual CSS theme switcher with vanilla javascript snippet
.theme input {
display: none;
}
.theme {
margin: 0 0.3em 0 0;
}
.theme input + label {
color: #f90;
@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,
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):
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
@petermolnar
petermolnar / unfix-all-the-toolbars.user.js
Last active June 29, 2022 07:25 — forked from vbuaraujo/unfix-all-the-toolbars.user.js
GreaseMonkey script to remove "position: fixed" from webpages
// ==UserScript==
// @name unfix-all-the-toolbars
// @description Removes "position: fixed" style from elements, unfixing "toolbars" and the such.
// @namespace http://inf.ufrgs.br/~vbuaraujo/
// @include *
// @version 1.2
// @grant none
// ==/UserScript==
@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 / backup-github.sh
Last active September 3, 2020 20:25
backup-github
#!/usr/bin/env bash
function usage () {
echo "backup-github.sh
A tiny bash script to backup own and starred public github repositories
Usage:
backup-github.sh GITHUB_USERNAME DIRECTORY_TO_BACKUP_TO"
exit 1