Skip to content

Instantly share code, notes, and snippets.

View kevin39's full-sized avatar

Kevin LABECOT kevin39

View GitHub Profile
@kevin39
kevin39 / pagespeed-requirement.vcl
Created June 29, 2020 05:43 — forked from section-io-gists/pagespeed-requirement.vcl
Using the PageSpeed module alongside Varnish, you will need to configure Varnish to handle PageSpeed optimizations.
# Note: You will want to add the snippet: `include "pagespeed-requirement.vcl";` above your `vcl_recv` in the default.vcl file.
sub vcl_recv {
call pagespeed_capability_detection;
}
# Function derived from requirements here https://modpagespeed.com/doc/downstream-caching#ps-capabilitylist
# Additional detection logic for crawlers, tablet and mobile devices.
sub pagespeed_capability_detection {
if (req.http.User-Agent ~ "(?i)Chrome/[3][2-9]+\.|Chrome/[4-9][0-9]+\.|Chrome/[0-9]{3,}\.") {
@kevin39
kevin39 / varnish.vcl
Created June 17, 2020 13:25 — forked from TomCan/varnish.vcl
Enable gzip compression in Varnish
sub vcl_recv {
...
if (req.http.Accept-Encoding) {
if (req.url ~ "\.(jpeg|jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|flv)$") {
unset req.http.Accept-Encoding;
} elsif (req.http.Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
} elsif (req.http.Accept-Encoding ~ "deflate" &&
req.http.user-agent !~ "MSIE") {
set req.http.Accept-Encoding = "deflate";
@kevin39
kevin39 / Compress Magento media
Created June 12, 2020 14:34 — forked from wigman/Compress Magento media
Compress Magento media from commandline
# you need these installed if you want to:
sudo apt-get update
# resize images
sudo apt-get install imagemagick -y
# compress jpg and png files
sudo apt-get install jpegoptim optipng
# compress video's
sudo apt-get install ffmpeg
@kevin39
kevin39 / docker-compose.yml
Created February 15, 2019 10:16 — forked from tebeka/docker-compose.yml
HAProxy in front of Elasticsearch
elastic:
image: elasticsearch
haproxy:
image: haproxy
volumes:
- ${PWD}:/usr/local/etc/haproxy
links:
- elastic
ports:
sysctl fs.inotify.max_user_instances=256
pct list |awk 'FNR > 1 {print "VMID=" $1 " - " $3}'
@kevin39
kevin39 / apilist.txt
Created April 17, 2018 04:01 — forked from yoimbert/apilist.txt
list api Fibaro HC2
Signification des variables :
<LOGIN> = L'utilisateur autorisé à effectuer l'action (ex: admin)
<PASS> = Votre mot de passe
<IP> = L'adresse IP de votre Home Center, il est donc nécessaire de lui attribuer une IP fixe (via la rédervation de bail de votre box / routeur Internet)
<ID> = identifiant du module Z-Wave (comment trouver l'ID d'un module ?)
name = action (ex: turnOff, turnOn, setValue)
<Value> = valeur (ex: niveau de variation à 39 % --> arg1=39 )
Exemples :
@kevin39
kevin39 / cpu-numa-compatible
Created June 30, 2017 06:29
Check if CPU is numa compatible
$ numactl --hardware | grep available
# If greater than 2 : NUMA is supported
@kevin39
kevin39 / lvm-very-slow
Created May 23, 2017 07:07
LVM - Slow lvremove
Try to add --noudevsync
Example :
lvremove -v --noudevsync <path to volume>
@kevin39
kevin39 / search and replace in files
Last active May 18, 2017 12:22
Recursive find and replace
grep -rl "OLD STRING" /etc/iscsi/nodes/ | xargs sed -i "s/OLD STRING/NEW STRING/g"