Skip to content

Instantly share code, notes, and snippets.

@paresy
paresy / guide.md
Created October 18, 2026 09:04
Grid Configuration Guide

Tile Visualization: Grid Configuration Guide

This guide explains how to read and change the grid layout of an IP-Symcon Tile Visualization from PHP. It is written so that a script, or an AI assistant writing scripts, can adjust the layout dynamically. It contains everything needed for that and nothing about the app's internals.

What the grid configuration controls

The Tile Visualization shows the objects of the object tree as tiles on a

@paresy
paresy / enable.js
Created July 16, 2022 20:20
(Re-)Enable all AWS SNS endpoints
let aws = require("aws-sdk");
let platformArn = "arn:aws:sns:eu-west-1:*******************";
(async function() {
let sns = new aws.SNS({region: 'eu-west-1'});
let request = {
"PlatformApplicationArn": platformArn
};
@paresy
paresy / tzdata.patch
Created August 28, 2020 07:37
simplify tzdata folder structure
diff -ur buildroot/package/tzdata/tzdata.mk buildroot-patched/package/tzdata/tzdata.mk
--- buildroot/package/tzdata/tzdata.mk 2020-08-26 21:07:57.000000000 +0200
+++ buildroot-patched/package/tzdata/tzdata.mk 2020-08-27 16:54:38.000000000 +0200
@@ -41,18 +41,13 @@
define TZDATA_INSTALL_TARGET_CMDS
$(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/share/zoneinfo
cp -a $(HOST_DIR)/share/zoneinfo/* $(TARGET_DIR)/usr/share/zoneinfo
- cd $(TARGET_DIR)/usr/share/zoneinfo; \
- for zone in posix/*; do \
- ln -sfn "$${zone}" "$${zone##*/}"; \
@paresy
paresy / switchoff.service
Last active April 13, 2020 08:54
Start service for switchOff
*** Install with...
sudo nano /etc/systemd/system/switchOff.service
sudo systemctl start switchOff
sudo systemctl enable switchOff
*************************************
[Unit]
Description=SwitchOff Tool
After = NetworkManager-wait-online.service network.target network-online.target dbus.service
Wants = NetworkManager-wait-online.service network-online.target
@paresy
paresy / switchOff.c
Last active April 13, 2020 08:06
Monitor X11 display activity and disable HDMI on inactivity (Raspberry Pi)
//Install dependencies: sudo apt install libxss-dev
//Compile with: gcc -o switchOff switchOff.c -lXss -lX11
#include <X11/extensions/scrnsaver.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
int main(void) {
Display *dpy = NULL;
@paresy
paresy / srp6a.php
Last active February 18, 2018 17:24
SRP6a PHP
<?php
//Docs: http://srp.stanford.edu/design.html
//Test Vector: https://github.com/wolfSSL/wolfssl/issues/18#issuecomment-83941582
//Copyright: Michael Maroszek
//Hint: The old version used BCMath with was 100 times slower!
//Modulus
$N = "FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08 8A67CC74
@paresy
paresy / gist:236bfbfcb26e6936eaae919b3cfdfc4f
Last active December 3, 2019 10:52
Best Practice zur PHP-Modul Erstellung

Best Practice zur PHP-Modul Erstellung

  1. Generelle Entwicklung
    1. Module sollten grundsätzlich auf Englisch erstellt und ins Deutsche übersetzt werden
    2. Fehlermeldungen dürfen mit @ nur verdeckt werden, wenn der Rückgabewert überprüft wird und bei einem echten Fehlerfall dies dem Nutzer mitgeteilt wird. Andernfalls findet man im Fehlerfall den Verursacher niemals heraus. Sichtbare Fehler können behoben werden. Unsichtbare Fehler bringen inkonsistentes Verhalten und frustrieren nur alle beteiligten.
    3. Daten, welche der Benutzer nicht benötigt, sollten auch nicht in Variablen erscheinen (z.B. irgendwelche Puffer / Temporäre Inhalte in String Variablen). Dafür bietet das SDK die SetBuffer/GetBuffer Funktionen, welches über eine JSON Kodierung auch mehrere Elemente enthalten können.
  2. Der Inhalt der library.json / module.json darf nur die von der Dokumentation definierten Felder enthalten. Andere Felder können in zukünftigen Version seitens IP-Symcon verwendet werden und sind vollständig r
@paresy
paresy / functions.ips.php
Last active July 2, 2025 15:17
Generated Functions for IP-Symcon 5.5
<?php
$_IPS = array (
'SELF' => 0,
'SENDER' => '',
'VALUE' => 0,
'OLDVALUE' => 0,
'OLDUPDATED' => 0,
'OLDCHANGED' => 0,
'VARIABLE' => 0,
@paresy
paresy / generate.php
Last active October 31, 2024 09:54
Build PHP functions stubs for PHPStorm inclusion
<?php
/**
* Copyright: Michael Maroszek
* Version: 1.3, 07.08.2019
* Requires: IP-Symcon 5.2 or newer
*/
echo "<?php" . PHP_EOL . PHP_EOL;
@paresy
paresy / gist:3cbd4c6a469511ac7479aa0e7c42fea7
Last active December 21, 2022 01:43
PHP Embed Example
#include <stdio.h>
#include <iostream>
#include <thread>
#include <list>
#include <sapi/embed/php_embed.h>
int main(int argc, char* argv[]) {
int threadCount = 5;