Skip to content

Instantly share code, notes, and snippets.


Michele Locati mlocati

View GitHub Profile
mlocati / php-cs-fixer.cmd
Created Nov 8, 2016
Call php-cs-fixer by automatically locating the configuration file
View php-cs-fixer.cmd
@echo off
setlocal enabledelayedexpansion
if "%~1" equ "" (
echo Missing file name>&2
goto :eof
if "%~2" neq "" (
mlocati /
Last active Dec 20, 2019
Convert SVN repository to GIT
# This script was written for Ubuntu 14.04 and 16.04
# Other operating systems may need a few changes
mlocati / app.php
Last active Sep 29, 2019
Install concrete5 on Android (Termux)
View app.php
// Save this file as /application/bootstrap/app.php
if (!function_exists('fnmatch')) {
// Shim for fnmatch
// Code from
define('FNM_PATHNAME', 1);
define('FNM_NOESCAPE', 2);
define('FNM_PERIOD', 4);
define('FNM_CASEFOLD', 16);
mlocati /
Last active Jun 28, 2019
Correct wrong email and name in all git commits
CORRECT_NAME="Correct Name"
git filter-branch --env-filter '
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]; then
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]; then
mlocati /
Created Jan 23, 2019
Check if a go-pear.phar file is an official one
# This script checks if a go-pear.phar is the same as one of the
# ones released on
# MIT License
# Made by Michele Locati <> on 2019-01-23
set -o errexit
set -o nounset
mlocati / compile-php.cmd
Created Oct 7, 2016
Script to compile PHP
View compile-php.cmd
@echo off
setlocal enabledelayedexpansion
rem Reference:
set MY_VSDIR=C:\Path\To\Microsoft Visual Studio 14.0
set PATH=%SystemRoot%\System32
echo # Compiling PHP
mlocati / output.html
Last active Mar 15, 2017
Punic units
View output.html
<!DOCTYPE html>
<title>Punic Units sample</title>
<meta name="charset" value="utf-8" />
<link rel="stylesheet" href="" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<table class="table table-striped table-bordered">
mlocati /
Created Dec 24, 2015
concrete5 under nginx

Here's a very basic nginx configuration for a website running concrete5:

# Define the server configuration
server {
	# Define the ports the server is listening to
	# In case this is the default website, you can add default_server before the semicolon
	listen 80;
	listen [::]:80 ipv6only=on;
mlocati / translate-countries.js
Last active Jun 16, 2016
Translate Country names for Webogram
View translate-countries.js
/* A little utility to translate Country names for Webogram.
* You need to install nodejs.
* Usage: node <thisfile> <languageCode> <inputFile> [outputFile]
* If outputFile is not specified, inputFile will be overwritten.
* @author: Michele Locati <>
* @licence: MIT
try {
var fs = require('fs'), path = require('path');
mlocati / remove-old-kernel-versions.php
Last active Aug 29, 2015
Remove old kernel versions, by keeping only the active one and the latest one
View remove-old-kernel-versions.php
try {
$doEcho = true;
$action = 'view';
if(isset($argv) && is_array($argv) && (count($argv) == 2)) {
$action = strtolower($argv[1]);
switch($action) {
case 'view':
case 'simulate':