Skip to content

Instantly share code, notes, and snippets.

View mklooss's full-sized avatar

Mathis Klooß mklooss

View GitHub Profile
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 / 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 / 1_database_export_import_readme.txt
Last active November 13, 2023 06:58
Export MySQL/MariaDB Database in Tables
Written on Debian Based Systems
usage: mysql_[import|export].sh DATABASENAME
Splits Database in to multplie files, based on Table Names
schema.sql will be also created!
i've an my_import.cnf / my_export.cnf or exists, this files will be used as Credentails, default is the debian default file.
Files: schema.sql, routines_triggers.sql
@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 / gist:4023540
Created November 6, 2012 08:46
Magento Delete Old Session Files
#!/bin/bash
# delete files older than 14 days
DIR=/var/www/magento/var/session/
/usr/bin/find $DIR -depth -mtime +14 -exec rm -rf '{}' \;
@mklooss
mklooss / remove_Temando_Shipping.sql
Last active February 13, 2023 19:09
Remove Temando_Shipping from Magento2!
DELETE FROM eav_attribute WHERE attribute_code IN('ts_dimensions_length', 'ts_dimensions_width', 'ts_dimensions_height', 'ts_packaging_type', 'ts_packaging_id', 'ts_country_of_origin', 'ts_hs_code');
DROP TABLE temando_order;
DROP TABLE temando_quote_collection_point;
DROP TABLE temando_collection_point_search;
DROP TABLE temando_order_collection_point;
DROP TABLE temando_quote_pickup_location;
DROP TABLE temando_pickup_location_search;
DROP TABLE temando_order_pickup_location;
@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 / 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:'));