Skip to content

Instantly share code, notes, and snippets.

View fquffio's full-sized avatar
🐈
Working

Paolo Cuffiani fquffio

🐈
Working
  • Bologna, Italy
  • 05:23 (UTC +02:00)
View GitHub Profile
@fquffio
fquffio / terraform-providers-versions-check
Created March 21, 2024 15:50
Extemely simple shell script to check if currently installed Terraform providers are to the latest available version. Requires Terraform, JQ and CURL.
#!/bin/sh
set -eo pipefail
if ! command -v terraform &> /dev/null
then
echo 'Terraform is not installed or `terraform` executable could not be found in $PATH.' >&2
exit 127
fi
if ! command -v jq &> /dev/null
@fquffio
fquffio / vid2gif.sh
Created October 25, 2020 18:41
Convert video to GIF
#!/bin/sh
INPUT=myvideo.mov
OUTPUT=myvideo.gif
ffmpeg -y -i $INPUT -filter_complex "fps=10[x]; [x]split[x1][x2]; [x1]palettegen[p]; [x2][p]paletteuse" $OUTPUT
@fquffio
fquffio / docker-compose.yml
Created August 18, 2017 08:07
BEdita Docker Compose
---
version: "2.1"
volumes:
database:
files:
services:
manager:
image: "bedita/manager"
depends_on:
@fquffio
fquffio / BenchmarkShell.php
Last active June 18, 2017 11:03
Benchmark shell to test performances of CTI read/write operations.
<?php
/**
* BEdita, API-first content management framework
* Copyright 2017 ChannelWeb Srl, Chialab Srl
*
* This file is part of BEdita: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@fquffio
fquffio / keybase.md
Created April 14, 2017 11:02
Keybase identity proof

Keybase proof

I hereby claim:

  • I am fquffio on github.
  • I am fquffio (https://keybase.io/fquffio) on keybase.
  • I have a public key ASDDy5NA2ohMfgRPHcKmAo9ADty_ioNBlZH1ONINPxsuYAo

To claim this, I am signing this object:

@fquffio
fquffio / docker-elasticsearch-cluster.sh
Last active December 9, 2015 14:05
Create an Elasticsearch cluster with one exposed node (with a Kopf panel installed) that acts as the "master" and a variable amount of "slave" (though they are eligible as masters, too) nodes.
###
# Create an ElasticSearch cluster
###
ES_NODES_COUNT=4
HOSTS=es_master
for (( i=1; i<=$ES_NODES_COUNT; i++ )); do HOSTS=${HOSTS},es_node0$i; done
echo ${HOSTS}
# Create the first ES machine
docker run -d --name es_master \
@fquffio
fquffio / docker-swarm.sh
Last active December 9, 2015 11:58
Create a Docker swarm with one master node and a variable amount of slave nodes using a Consul discovery service.
###
# Create a swarm cluster
###
SWARM_NODES_COUNT=2
# Create a Consul discovery container on `default` Docker machine
docker run -d --name swarm-consul \
--restart=always \
-p "8500:8500" \
-h "consul" \
@fquffio
fquffio / glob_match.php
Created November 8, 2015 15:01
GLOB-style match
<?php
if (!function_exists('glob_match')) {
/**
* Filter keys with a GLOB-style pattern.
*
* @param string $subject Test string.
* @param string $pattern GLOB-style pattern.
* @param int $flags Optional flags (only `GLOB_BRACE` is valid).
* @return bool Match.
@fquffio
fquffio / Vagrantfile
Last active October 19, 2015 06:41
Basic LAMP setup on Vagrant.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/trusty64"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,