Skip to content

Instantly share code, notes, and snippets.

View fgbreel's full-sized avatar

Gabriel Francisco fgbreel

View GitHub Profile
@fgbreel
fgbreel / download-and-update-local-repository.sh
Created March 31, 2022 17:06
Download installed packages and generate local debian repository.
#!/bin/bash
# download installed packages and generate local debian repository
# this command can make your computer very busy! watch out!
dpkg -l | tail -n +5 | awk '{print $2}' | while read line; do (apt download $line -t sid &); done && dpkg-scanpackages ./ > Packages && gzip -k -f Packages
@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
@fgbreel
fgbreel / Dockerfile
Last active November 3, 2020 11:16
k8s nutshell
FROM debian:stable
RUN apt-get update \
&& apt-get -y --no-install-recommends install \
python \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
EXPOSE "8000"
ENTRYPOINT ["python", "-m", "SimpleHTTPServer"]
@fgbreel
fgbreel / docker-networking.sh
Created June 16, 2017 12:34
docker networking
# create network for containers
docker network create foobar
# launch mysql container within foobar network and set its name to 'database':
# you can also add --network-alias='mysql.foobar.local' to add a FQDN if you like.
docker run --detach --name=database --network=foobar --tmpfs=/var/lib/mysql/:rw,noexec,nosuid,size=7000m --env MYSQL_ALLOW_EMPTY_PASSWORD=1 --env MYSQL_DATABASE=foobar mysql:5.6 mysqld
# wait mysql to initialize innodb logs and become ready for connections:
sleep 5
@fgbreel
fgbreel / build-php-zts.sh
Last active July 3, 2022 22:34
Build PHP7 with ZTS on Debian Stretch
#!/usr/bin/env bash
apt-get build-dep php7.0
mkdir ~/php7-amd64 && cd ~/php7-amd64
apt-get source php7.0
cd php7.0-7.0.19
# rename packages to *-zts
@fgbreel
fgbreel / Dockerfile
Last active April 4, 2017 20:12
A self registered micro service example from gomicro
FROM golang:onbuild
nginx:
pkg.installed
git-core:
pkg.installed
apt-transport-https:
pkg.installed
https://github.com/fgbreel/fabio.git:
#!/usr/bin/perl
use DBI;
# Connect to the local database
$dbh = DBI->connect('DBI:mysql:host=localhost;database=mysql', 'root', 'password') || die;
# Flush and lock tables to prepare for LVM snapshot
$dbh->do('FLUSH TABLES WITH READ LOCK;');