Skip to content

Instantly share code, notes, and snippets.

Avatar

Mathis Klooß mklooss

View GitHub Profile
@mklooss
mklooss / t3 total cache varnish config
Last active January 17, 2023 08:55
varnish-wordpress-w3-total-cache.vcl
View t3 total cache varnish config
# 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
View sitemap-xml-warmup.php
<?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
View twemproxy.yaml
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
View letsencrypt-auto-create-domain-tls.php
<?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
View iptables-route-port-to-ip.sh
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 April 14, 2023 11:12
shopware 6 varnish sample config
View nginx-shopware6.conf
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
View zwavejs2mqtt-update-from-source.sh
#!/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/
@mklooss
mklooss / grub-install.sh
Created May 5, 2021 13:28
install grub to every device!
View grub-install.sh
#!/bin/bash
find /dev/ -maxdepth 1 \( -name 'sd[a-z]' -o -name 'nvme[0-9]n[0-9]' \) -exec grub-install "{}" \;
View docker-imap-devel.sh
#/bin/bash
# running an test imap server for testing
docker run \
--name imap-devel \
-p 127.0.0.1:1143:143/tcp \
-p 127.0.0.1:1993:993/tcp \
-e MAILNAME=mail.example.com \
-e MAIL_ADDRESS=service@example.com \
@mklooss
mklooss / magento1_fix_auto_increment.sql
Created December 3, 2020 13:19
Magento1 issues with out of range value_id
View magento1_fix_auto_increment.sql
DELETE FROM catalog_product_entity_datetime WHERE entity_id NOT IN (SELECT entity_id FROM catalog_product_entity);
DELETE FROM catalog_product_entity_datetime WHERE attribute_id NOT IN (SELECT attribute_id FROM eav_attribute);
DELETE FROM catalog_product_entity_decimal WHERE entity_id NOT IN (SELECT entity_id FROM catalog_product_entity);
DELETE FROM catalog_product_entity_decimal WHERE attribute_id NOT IN (SELECT attribute_id FROM eav_attribute);
DELETE FROM catalog_product_entity_int WHERE entity_id NOT IN (SELECT entity_id FROM catalog_product_entity);
DELETE FROM catalog_product_entity_int WHERE attribute_id NOT IN (SELECT attribute_id FROM eav_attribute);
DELETE FROM catalog_product_entity_text WHERE entity_id NOT IN (SELECT entity_id FROM catalog_product_entity);