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:
@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 / haproxy.cfg
Created March 23, 2017 14:27 — forked from GABeech/haproxy.cfg
Stack Exchange HAProxy
# This is an example of the Stack Exchange Tier 1 HAProxy config
# The only things that have been changed from what we are running are:
# 1. User names have been removed
# 2. All Passwords have been remove
# 3. IPs have been changed to use the example/documentation ranges
# 4. Rate limit numbers have been changed to randome numbers, don't read into them
userlist stats-auth
group admin users $admin_user
user $admin_user insecure-password $some_password
@kevin39
kevin39 / nginx-tuning.md
Created November 8, 2016 10:26 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400,000 to 500,000 requests per second (clustered), most what i saw is 50,000 to 80,000 (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@kevin39
kevin39 / PfSense DNS Batch Creation
Last active September 20, 2016 12:25 — forked from brycied00d/gist:13483a1d8363e457f963
pfSense DNS Forwarder Batch Host Creation
<?php
// pfSense PHP script to generate a range of DNS forwarder hosts based on
// "dot${lastoctet}", eg. 192.0.2.100 == dot100.example.com
// Open terminal, run "php" copy/paste script with the following defines tweaked
// Ctrl-D, wait a moment until you see "Content-type: text/html"
// Open the DNS config in the web UI and click Apply Changes
define('DOT_DOMAIN', 'example.com');
define('DOT_SUBNET', '192.0.2.'); // Leave off the final octet, include the dot
define('DOT_RANGE_START', 100);