Skip to content

Instantly share code, notes, and snippets.

View mklooss's full-sized avatar

Mathis Klooß mklooss

View GitHub Profile
@mklooss
mklooss / magento2-generate-url-rewrite-cms-page-if-missing-store_id1.sql
Created August 21, 2024 07:53
Create Magento2 CMS Page URLs if Missing, idk why, but we missed some
INSERT INTO url_rewrite
SELECT
NULL AS url_rewrite_id,
'cms-page' AS entity_type,
cp.page_id AS entity_id,
cp.identifier AS request_path,
CONCAT('cms/page/view/page_id/', cp.page_id) AS target_path,
0 AS redirect_type,
1 AS store_id,
NULL as description,
@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
@mklooss
mklooss / nginx.conf
Last active November 13, 2024 06:49
webp
# inside of http {}, outside of server
# may create file: /etc/nginx/conf.d/webp.conf
map $http_accept $webp_suffix {
default "";
"~*webp" ".webp";
}
# inside server {}
# /etc/nginx/sites.d/*.conf
location ^~ /thumbnail/ {
@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 16, 2024 08:37
Create Based on CertDomains and GoogleDNS the Cert, when ur moving an project
<?php
$hostips = array('999.999.999.999', '888.888.888.888');
$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 November 7, 2024 14:37
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;