Skip to content

Instantly share code, notes, and snippets.

View fgbreel's full-sized avatar

Gabriel Francisco fgbreel

View GitHub Profile
@fgbreel
fgbreel / default.vcl_PREFACE.md
Created November 1, 2021 10:04 — forked from fevangelou/default.vcl_PREFACE.md
The perfect Varnish configuration for Joomla, WordPress & other CMS based websites

The perfect Varnish configuration for Joomla, WordPress & other CMS based websites

IMPORTANT: Read this before implementing one of the configuration files below (for either Varnish 3.x or 4.x+).

USE: Replace the contents of the main Varnish configuration file located in /etc/varnish/default.vcl (root server access required - obviously) with the contents of the configuration you'll use (depending on your Varnish version) from the 2 examples provided below.

IMPORTANT: The following setup assumes a 180 sec (3 minute) cache time for cacheable content that does not have the correct cache-control HTTP headers. You can safely increase this to 300 sec (or more) for less busier sites or drop it to 60 sec or even 30 sec for high traffic sites.

This configuration requires an HTTP Header and a user cookie to identify if a user is logged in a site, in order to bypass caching overall (see how it's done for Joomla & WordPress). If your CMS provides a way to add these two requirements, then you can use this configurati

@fgbreel
fgbreel / jenkins-ssh-decrypt.py
Created March 12, 2021 10:15 — forked from khramtsoff/jenkins-ssh-decrypt.py
Decrypt jenkins ssh hashes
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# original: https://raw.githubusercontent.com/tweksteen/jenkins-decrypt/master/decrypt.py
# detailed explanation: http://thiébaud.fr/jenkins_credentials.html
import re
import sys
import base64
from hashlib import sha256
from binascii import hexlify, unhexlify
@fgbreel
fgbreel / create_admin_user.sh
Last active March 1, 2021 10:04 — forked from steimntz/create_user_for_namespace.sh
Script to create admin user.
#!/bin/bash
#
# Script based on https://jeremievallee.com/2018/05/28/kubernetes-rbac-namespace-user.html
#
# In honor of the remarkable Windson
#
# Modified by Gabriel Francisco to create cluster-admin users.
username=$1
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@fgbreel
fgbreel / mask.rb
Created March 24, 2016 21:07 — forked from pgr0ss/mask.rb
def mask n;n.slice(0,6)+"*"*(n.size-10)+n.slice(-4,4);end
@fgbreel
fgbreel / whisper-calculator.py
Created February 11, 2016 13:19 — forked from jjmaestro/whisper-calculator.py
whisper-calculator.py: Calculates the size of the whisper storage for the given retention (in frequency:history format)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def archive_to_bytes(archive):
def to_seconds(s):
SECONDS_IN_A = {
's': 1,
'm': 1 * 60,
'h': 1 * 60 * 60,
@fgbreel
fgbreel / postfix_grok_pattern
Created November 14, 2015 02:41 — forked from brablc/postfix_grok_pattern
Logstash example configuration for parsing Postfix mail log files
# Postfix stuff based on https://gist.github.com/jbrownsc/4694374:
QUEUEID (?:[A-F0-9]+|NOQUEUE)
EMAILADDRESSPART [a-zA-Z0-9_.+-=:]+
EMAILADDRESS %{EMAILADDRESSPART:local}@%{EMAILADDRESSPART:remote}
RELAY (?:%{HOSTNAME:relayhost}(?:\[%{IP:relayip}\](?::[0-9]+(.[0-9]+)?)?)?)
POSREAL [0-9]+(.[0-9]+)?
DELAYS (%{POSREAL}[/]*)+
DSN %{NONNEGINT}.%{NONNEGINT}.%{NONNEGINT}
STATUS sent|deferred|bounced|expired