Skip to content

Instantly share code, notes, and snippets.

View kevin39's full-sized avatar

Kevin LABECOT kevin39

View GitHub Profile
@kevin39
kevin39 / Proxmox reload services
Last active March 5, 2024 20:13
Proxmox reload services properly (services order is important)
service pve-cluster restart && service pvedaemon restart && service pvestatd restart && service pveproxy restart
@kevin39
kevin39 / HAPROXY LDAP SETTINGS - WINDOWS COMPATIBLE
Last active March 14, 2022 21:29
HAProxy ldap-check compatible with Windows Server / Active Directory
# Note : Found somewhere on internet... Source lost
backend ldap_balancer
mode tcp
balance roundrobin
server SERVER_NAME SERVER_ADDR:389 maxconn 100 check
option tcpka
timeout server 2s
timeout connect 1s
# Below, ldap check procedure :
option tcp-check
@kevin39
kevin39 / nfsd-on-lxc
Created March 2, 2017 10:05
NFSD on LXC
Create a new file "/etc/apparmor.d/lxc/lxc-default-with-nfsd" and paste in the following;
Code:
# Do not load this file. Rather, load /etc/apparmor.d/lxc-containers, which
# will source all profiles under /etc/apparmor.d/lxc
profile lxc-container-default-with-nfsd flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/lxc/container-base>
# the container may never be allowed to mount devpts. If it does, it
@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 / ChanSpy Direct agent
Last active March 25, 2020 14:19
Asterisk - ChanSpy Direct agent
http://jonathanmanning.com/2009/10/29/monitoring-agents-in-asterisk-with-chanspy/
Example 3: This example will give the ability to dial directly into an agents phone to listen to them.
[internal] ;Chanspy Direct SIP Extension
exten => _88XXXX,1,Chanspy(SIP/${EXTEN:2}|b)
Here you can dial directly into any agents 4 digit phone extension and listen to them, for example if you wanted to listen to sip extension 5400 then dial 88+5400. That would dial directly into monitoring phone extension number 5400. If your phones only have 3 digits remove one of the “X”‘s from the exten line.
@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}'