Skip to content

Instantly share code, notes, and snippets.

Mauro Artizzu mauroartizzu

Block or report user

Report or block mauroartizzu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mauroartizzu
mauroartizzu / tar_git_commit.sh
Last active Sep 6, 2018
[Tar-Zip Current Commit Hash] Tar-Zip Recursively excluding folders with current commit filename #tar #zip #git #commit
View tar_git_commit.sh
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 Sep 6, 2018
[Git Laravel Initial Commit] Output Laravel version to git commit #laravel #git
View git_laravel_version.sh
php artisan -V | git commit -F -
@mauroartizzu
mauroartizzu / nginxproxy.md
Created May 31, 2016 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?
View nginxproxy.md

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

View createdb.sh
#!/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;"
View gist:3d9976fbc6b0daaac6d5
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 Aug 28, 2015
Sublime Text 3 Dropbox Sync
View gist:5c359f295b02f9534c25
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 Jul 27, 2014
Database Comuni Italiani
View comuni.sql
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 Oct 2, 2013
NGINX Config PHP - Rails
View gist:6794050
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;
View gist:5857371
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 Feb 6, 2013
MySQL Full Outer Join
View gist:4723761
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
You can’t perform that action at this time.