Optimizing web performance

Optimizing web performance for WordPress and general websites. Apache2 vs Nginx Some time ago a question was asked on the Domoticz forum why I used Apache2 instead of Nginx. The answer was quite simple, just because I always used Apache2 and therefor didn’t know Nginx. Time for some investigation… I first started at my home …
View

macOS Catalina move caches and logs to RAMdisk

In a previous post I wrote about how I monitor the writes to several SSD’s.Second post in this series is about macOS Catalina, how to use a RAM disk to store caches and logs so you can avoid unnecessary disk writes. Caches are used to speed up applications. For example a browser caches images, Javascript …
View

IFTTT Applet skipped, Unable to make web request: Error: ETIMEDOUT

I’ve been using IFTTT for quite a while now. Until now I only used it to store the data of the Withings body scale in a MySQL database. Now that’s gonna change since Bosch released their IFTTT integration for the Easycontrol CT200 room thermostat. Of course that has to get integrated into Domoticz and Pass2PHP …
View

Centralized Fail2ban database

Centralized fail2ban database I like fail2ban a lot. It blocks intrusions in realtime based on the jails you configure. The jails monitor logfiles for certain words. I’m not going to explain that here, there’s enough on the net about fail2ban. The one problem I had with fail2ban is that it’s has a local database. I …
View

PHP Floorplan 2.0 for Domoticz

Update of PHP Floorplan for Domoticz and PHP Floorplan for Domoticz Extra screenshots I’ve been busy lately optimizing the code so it has a very small footprint on data traffic. I managed to optimize the code in a way that each pageview only requires 2.3KB instead of the 41KB before. Most of that is achieved by moving the …
View

LUA Pass2PHP v2.2 minimal script

<?php error_reporting(E_ALL); ini_set(“display_errors”,”on”); date_default_timezone_set(‘Europe/Brussels’); define(‘time’,$_SERVER[‘REQUEST_TIME’]); $c=json_decode(base64_decode($_REQUEST[‘c’]),true); $s=json_decode(base64_decode($_REQUEST[‘s’]),true); $i=json_decode(base64_decode($_REQUEST[‘i’]),true); $t=json_decode(base64_decode($_REQUEST[‘t’]),true); $r=str_replace(” “,”_”,key($c)); if(function_exists(key($c))) key($c)(); elseif(function_exists($r)) $r(); //START USER FUNCTIONS function pirhall() { global $s,$i,$t; if($s[‘pirhall’==”On”]) { if($s[‘lighthall’]==’Off’) sw($i[‘hall’],’On’,’hall by pir’,1000); } } //END USERFUNCTIONS. Only change IP:PORT and ios,sms account details below function sw($idx,$action=””,$info=””,$Usleep=600000) { lg(“SWITCH “.$action.” “.$info); if(empty($action)) curl(“http://127.0.0.1:8084/json.htm?type=command&param=switchlight&idx=”.$idx.”&switchcmd=Toggle”); else curl(“http://127.0.0.1:8084/json.htm?type=command&param=switchlight&idx=”.$idx.”&switchcmd=”.$action); usleep($Usleep); } function sl($idx,$level,$info=””,$Usleep=600000) …
View

LUA Pass2PHP v2.2 complete script

Another update for my Pass2PHP script. This time a great difference in setup. The $events array isn’t used anymore. Instead each update instantly executes the function with his name, if the function exists of course. Spaces can’t be used in function names, therefor they need to be replaced by underscores. In the $s, $i and …
View

LUA Pass2PHP v2.1 minimal script

Please read the information on LUA Pass2PHP v2.1 complete script for information about new stuff in 2.1 This script only contains the minimal stuff to get you started. In this example a PIR with idx 123 will switch a light on. <?php $c=json_decode(base64_decode($_REQUEST[‘c’]),true); $s=json_decode(base64_decode($_REQUEST[‘s’]),true); $i=json_decode(base64_decode($_REQUEST[‘i’]),true); $t=json_decode(base64_decode($_REQUEST[‘t’]),true); $a=$s[key($c)];$devidx=$i[key($c)]; $events=array( 123=>’pirhall’ ); if(isset($events[$devidx]))$events[$devidx](); //START USERFUNCTIONS function pirhall(){ global $a,$s,$i,$t; …
View

LUA Pass2PHP v2.1 complete script

Make sure you also read the other posts about pass2php on https://egregius.be/tag/domoticz/ as they contain more information on how to implement this. the script_device_pass2php.lua script has basically stayd the same: JSON=loadfile(‘/volume1/@appstore/domoticz/var/scripts/JSON.lua’)() base64=loadfile(‘/volume1/@appstore/domoticz/var/scripts/base64.lua’)() c=base64.encode(JSON:encode(devicechanged)) s=base64.encode(JSON:encode(otherdevices)) i=base64.encode(JSON:encode(otherdevices_idx)) t=base64.encode(JSON:encode(otherdevices_lastupdate)) os.execute(‘curl -s –data “c=’..c..’&s=’..s..’&i=’..i..’&t=’..t..'” http://127.0.0.1/secure/pass2php.php &’) commandArray={} return commandArray In the PHP file some changes are made in my own function. …
View

LUA Pass2PHP v2.0 Small example and explanation

Based on the script LUA Pass2PHP v2.0 a small example: 2 pirs in this script. They have idx 123 and idx 234. In the $events array we define wich function is called when this $idx is the changed device. Have a look at LUA Pass2PHP v2.0 for many more examples and conditional switching. Some explanation …
View

LUA Pass2PHP v2.0

Vervolg op LUA Pass2php In grote lijnen dezelfde werkwijze als de vorige versie, vooral de functies zijn een groot stuk eenvoudiger geworden waardoor de code wat overzichtelijker en makkelijker te gebruiken is. Download deze 2 bestanden en plaats ze in de Domoticz scripts folder: JSON.lua ee5_base64.lua Maak in Domoticz Events een device lua script, pas eventueel …
View

Fail2Ban on Synology DSM6

Fail2ban is a daemon that watches logfiles for errors using a regex expression. If errors are found actions are done. The most common action is blocking the source ip in firewall, or even higher using ‘ip route’. Since there isn’t much information available regarding running fail2ban on Synology DSM 6 it took some time to …
View