Skip to content

Instantly share code, notes, and snippets.

View lloiacono's full-sized avatar

Leandro Loiacono lloiacono

  • Warehousing1
  • Berlin
View GitHub Profile
@lloiacono
lloiacono / lambda_function.py
Created December 14, 2017 13:40
Labda function to shut down EC2 instances with a given tag
import boto3
region = 'eu-central-1'
testing_vpc_id = 'vpc-2352384b'
client = boto3.client('ec2', region_name=region)
def get_instances_in_vpc(vpc_id):
response = client.describe_instances(Filters=[{'Name': 'vpc-id',
@lloiacono
lloiacono / what
Created July 18, 2017 20:57
Vagrant osx fix permisions
ls -lR > /dev/null
@lloiacono
lloiacono / php-html-css-js-minifier.php
Created July 10, 2017 21:22 — forked from Rodrigo54/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
@lloiacono
lloiacono / .vimrc
Last active January 3, 2018 15:59
.dotfiles
#https://github.com/amix/vimrc
#https://github.com/scrooloose/nerdtree
set runtimepath+=~/.vim_runtime
source ~/.vim_runtime/vimrcs/basic.vim
source ~/.vim_runtime/vimrcs/filetypes.vim
source ~/.vim_runtime/vimrcs/plugins_config.vim
source ~/.vim_runtime/vimrcs/extended.vim
@lloiacono
lloiacono / dockerVolCleanUp.sh
Created May 2, 2017 08:04
Remove unused docker volumes
#!/usr/bin/env bash
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
docker ps -aq | xargs docker inspect | jq -r '.[]|.Mounts|.[]|.Name|select(.)'
) | xargs -r rm -fr
@lloiacono
lloiacono / Vagrantfile
Last active April 22, 2017 12:18
Template for vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "{{.Box}}"
config.vm.network "private_network", ip: "{{.Ipaddress}}"
@lloiacono
lloiacono / delete_local_branches.sh
Last active August 16, 2018 16:09
Delete local branches
#!/bin/bash
# Script to loop through local branches and delete them based on user input
for branch in `git branch | grep -v HEAD | grep -v master | grep -v \* | sort`;
do
read -p "Would you like to delete the branch $branch? [Y/n] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
@lloiacono
lloiacono / nginx.conf
Created December 8, 2016 09:55 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@lloiacono
lloiacono / Grunt Penthouse and Cssmin workflow.md
Created November 30, 2016 08:43
Grunt Penthouse and Css minify for extracting critical Css for embedding into HTML-head

Dutchwebworks Grunt Penthouse & Cssmin workflow

By Dennis Burger, Waddinxveen aug. 2014

This Grunt workflow task is using grunt-penthouse and grunt-contrib-cssmin plugins to extract Critical Path (above-the-fold content) Css from various URL's. This extracted Css can then be (re)inserted as embedded Css (using a HTML <style> -tag) back into the HTML-head of the corresponding webpage.

Using a lazy-loading technique, the other Css files could be loaded into the HTML-DOM later by Javascript. This greatly speeds up the initial page rendering and perception of page speed.

Google PageSpeed Insights recommends inlining this Critical Path Css into the HTML page to stop Css rendering blocking issues in the webbrowser. Website performance (and initial page render speed) are more and more becoming a important search-engine ranking factor.

delimiter ;;
drop procedure if exists build_catalog;;
create procedure build_catalog(IN categories INT, IN products INT)
begin
SET @category_count = 1;
SET @CATNAMEPREFIX = "Category ";
SET @CATURLKEYPREFIX = "cat-";
SET @CATURLPATHPREFIX = "catpath-";
SET @ROOTCATEGORY = 2;
SET @INCLUDEINMENU = 1;