Skip to content

Instantly share code, notes, and snippets.

View mklooss's full-sized avatar

Mathis Klooß mklooss

View GitHub Profile
@mklooss
mklooss / nulleinspeisung_hm1500.py
Created February 10, 2024 09:49
Nulleinspeisung HM1500 und Shelly 3EM
import pycurl
import json
import math
import time
from io import BytesIO
import sys
import requests
from requests.auth import HTTPBasicAuth
from datetime import datetime
Take care of your versions, do not downgrade!
1. Create Docker Image first (see 01_z_docker.sh)
2. Stop Docker Instance (docker stop mariadb-103)
3. Check data directory (permissions ls -aln, keep in mind, sample "chown 999:999")
4. Set Permission to Root User, on System MySQL/Mariadb (see 02_mysql_root.sql), may u have to start with --skip-grant-tables
4. Stop System MySQL/MariaDB
5. Copy Data /var/lib/mysql to new place for Docker ( rsync --delete --progress --numeric-ids -axAhHPc /old/ /new/ )
6. Chown /new/ Data to set the correct permission for the docker container
7. Start Both Container and System MariaDb
map $http_accept $webp_suffix {
default "";
"~*webp" ".webp";
}
pagespeed XHeaderValue "Powered By ngx_pagespeed";
location ^~ /thumbnail/ {
pagespeed off;
expires 1y;
add_header Pragma public;
@mklooss
mklooss / t3 total cache varnish config
Last active January 17, 2023 08:55
varnish-wordpress-w3-total-cache.vcl
# VCL version 5.0 is not supported so it should be 4.0 even though actually used Varnish version is 6
vcl 4.0;
import std;
# The minimal Varnish version is 6.0
# For SSL offloading, pass the following header in your proxy server or load balancer: 'SSL-OFFLOADED: https'
backend default {
.host = "10.0.1.2";
.port = "80";
@mklooss
mklooss / sitemap-xml-warmup.php
Last active August 31, 2022 06:03
Warmup from sitemap xml
<?php
exit; // change url first
$mainXmlUrl = 'https://www.example.com/sitemap.xml';
$mainXmlContent = curlUrlExec($mainXmlUrl);
$mainXml = @simplexml_load_string($mainXmlContent);
unset($mainXmlContent);
@mklooss
mklooss / twemproxy.yaml
Created September 23, 2021 09:30
twemproxy - https://github.com/twitter/twemproxy - Magento2 Shopware5 Config
sessions:
listen: 127.0.0.1:6386
hash: fnv1a_64
distribution: modula
auto_eject_hosts: true
redis: true
redis_db: 6
server_retry_timeout: 2000
server_failure_limit: 1
servers:
@mklooss
mklooss / letsencrypt-auto-create-domain-tls.php
Last active October 6, 2021 05:40
Create Based on CertDomains and GoogleDNS the Cert, when ur moving an project
<?php
$hostip = '999.999.999.999';
$certName = 'mostly.server.hostname.tld';
$domainsList = array(
'domain1.tld',
'domain2.tld',
);
$certdns = trim(shell_exec('openssl x509 -noout -text -in /etc/letsencrypt/live/'.$certName.'/cert.pem | grep DNS:'));
@mklooss
mklooss / iptables-route-port-to-ip.sh
Created August 12, 2021 12:31
Force Route all Port Traffic Thouth defined IP
iptables -t nat -A POSTROUTING -m mark --mark 0x0050/0xFFFFFFFF -j SNAT --to-source xxx.xxx.xxx.xxx
#Hex = Decimal
#0x0050 = 80
@mklooss
mklooss / nginx-shopware6.conf
Last active October 26, 2023 06:47
shopware 6 varnish sample config
server {
listen 127.0.0.1:8080;
index index.php index.html;
server_name varnish.default.tld;
root /home/USER/htdocs/public/;
location /recovery/install {
index index.php;
try_files $uri /recovery/install/index.php$is_args$args;
@mklooss
mklooss / zwavejs2mqtt-update-from-source.sh
Last active August 12, 2021 12:38
zwavejs2mqtt - manually update from source
#!/bin/bash
systemctl stop zwavejs2mqtt
git fetch --all --prune
LATESTTAG=$(git describe --tags `git rev-list --tags --max-count=1`)
rm -rf node_modules package-lock.json yarn.lock .yarnclean yarn-error.log
rm -rf /dist/
rm -rf /server/
rm -rf /store/