Skip to content

Instantly share code, notes, and snippets.

@mauroartizzu
mauroartizzu / tar_git_commit.sh
Last active September 6, 2018 21:00
[Tar-Zip Current Commit Hash] Tar-Zip Recursively excluding folders with current commit filename #tar #zip #git #commit
tar --exclude='*.git' --exclude='node_modules' --exclude='vendor' -zcvf `git rev-parse HEAD`.tgz *
zip -r `git rev-parse HEAD`.zip . -x *.git* vendor/\* node_modules/\* *.idea* *.vscode* *.sonarlint*
@mauroartizzu
mauroartizzu / git_laravel_version.sh
Last active September 6, 2018 20:47
[Git Laravel Initial Commit] Output Laravel version to git commit #laravel #git
php artisan -V | git commit -F -
@mauroartizzu
mauroartizzu / nginxproxy.md
Created May 31, 2016 08:25 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

#!/bin/bash
EXPECTED_ARGS=3
E_BADARGS=65
MYSQL=`which mysql`
Q1="CREATE DATABASE IF NOT EXISTS $1;"
Q2="GRANT USAGE ON *.* TO $2@localhost IDENTIFIED BY '$3';"
Q3="GRANT ALL PRIVILEGES ON $1.* TO $2@localhost;"
Q4="FLUSH PRIVILEGES;"
@mauroartizzu
mauroartizzu / gist:3d9976fbc6b0daaac6d5
Created January 24, 2016 18:54
Web Server Permissions
usermod -a -G www-data user
find /var/www/website.it/ -type d -print0 | xargs -0 chmod 775
find /var/www/website.it/ -type f -print0 | xargs -0 chmod 664
chown /var/www/website.it/
chmod g+s /var/www/website.it/
@mauroartizzu
mauroartizzu / gist:5c359f295b02f9534c25
Created August 28, 2015 06:59
Sublime Text 3 Dropbox Sync
cd ~/Library/Application\ Support/Sublime\ Text\ 3/
mkdir ~/Dropbox/Sublime
mv Installed\ Packages ~/Dropbox/Sublime
mv Packages ~/Dropbox/Sublime
ln -s ~/Dropbox/Sublime/Installed\ Packages
ln -s ~/Dropbox/Sublime/Packages
@mauroartizzu
mauroartizzu / comuni.sql
Created July 27, 2014 13:35
Database Comuni Italiani
CREATE TABLE `comuni` (
`id` smallint(4) NOT NULL,
`comune` varchar(48) NOT NULL DEFAULT '',
`prefisso` char(4) NOT NULL DEFAULT '',
`cap` char(5) NOT NULL DEFAULT '',
`codice_istat` char(6) NOT NULL DEFAULT '',
`codice_catasto` char(4) NOT NULL DEFAULT '',
`id_provincia` tinyint(3) NOT NULL,
`sigla` char(2) NOT NULL DEFAULT '',
`provincia` varchar(48) NOT NULL DEFAULT '',
@mauroartizzu
mauroartizzu / gist:6794050
Created October 2, 2013 13:46
NGINX Config PHP - Rails
upstream rails {
server 127.0.0.1:3000;
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}
server {
listen 80;
server_name ~^(?<domain>[^\.]+)\.(?<tld>[^\.]+)$;
root /var/www/vhosts/$domain.$tld/htdocs;
@mauroartizzu
mauroartizzu / gist:5857371
Created June 25, 2013 10:04
Sfumatura Tatone
background: #ffffff;
/* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM5OWNjZmYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #ffffff 0%, #99ccff 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#99ccff)); /* Chrome,Safari4+ */
background: -webkit-linear-grad
@mauroartizzu
mauroartizzu / gist:4723761
Created February 6, 2013 16:27
MySQL Full Outer Join
SELECT *
FROM TABELLA1
LEFT JOIN TABELLA2
ON TABELLA1.CAMPO1 = TABELLA2.CAMPO2
UNION
SELECT *
FROM TABELLA1
RIGHT JOIN TABELLA2
ON TABELLA1.CAMPO1 = TABELLA2.CAMPO2
WHERE TABELLA1.CAMPO1 IS NULL