Skip to content

Instantly share code, notes, and snippets.

View roberto-butti's full-sized avatar
🚀

Roberto Butti roberto-butti

🚀
View GitHub Profile
@roberto-butti
roberto-butti / install_django_virtualenv.sh
Last active August 29, 2015 14:14
My script for installing new Django project with virtualenv
PROJECTNAME=example
APPNAME=${PROJECTNAME}app
PROJECTDIR=${PROJECTNAME}_project
ENVNAME=${PROJECTNAME}env
SITENAME=${PROJECTNAME}sitename
echo "I will create ${PROJECTDIR} for${PROJECTNAME}"
mkdir ${PROJECTDIR}
cd ${PROJECTDIR}
@roberto-butti
roberto-butti / .htaccess
Created January 27, 2015 14:05
Porzione htaccess per impostazione header su assets statici
Header unset Pragma
FileETag None
Header unset ETag
<FilesMatch "\.(ico|pdf|jpg|jpeg|png|gif|css|js|mp3)$">
Header set Cache-Control "public, s-maxage=600"
Header unset Last-Modified
#Header unset Cookie
#Header unset Set-Cookie
</FilesMatch>
@roberto-butti
roberto-butti / Preferences.sublime-settings
Created May 8, 2015 08:27
Preferences.sublime-settings
{
"auto_indent": true,
"detect_indentation": true,
"font_size": 14,
"ignored_packages":
[
"Vintage"
],
"indent_to_bracket": false,
"smart_indent": true,
from opencv import cv as opencv
from opencv import highgui
import sys
print "Inizializzazione webcam"
camera = highgui.cvCreateCameraCapture(-1)
if (camera):
print "Camera inizializzata"
else:
@roberto-butti
roberto-butti / joke.php
Created September 1, 2011 20:18
php joke!
<?php
$a = 0;
$b = "";
if ($a != $b) {
echo "ehy, <$a> and <$b> are different!?!?!?!?!?\n";
} else {
echo "ehy, <$a> and <$b> are the same!?!?!?!?!?\n";
}
echo "ok, i was joking!\n";
if ($a !== $b) {
@roberto-butti
roberto-butti / gist:4954572
Created February 14, 2013 17:42
Validazione stringa lunga da 1 a 250 caratteri, che comprende: lettere minuscole, maiuscole, numeri, spazi, punto e trattino
<?php
$username = "user-name12";
$exp = "/^[a-zA-Z\d\ \.-]{1,250}$/i";
if (preg_match($exp, $username)) {
echo "Your username is ok.";
} else {
echo "Wrong username format.";
}
@roberto-butti
roberto-butti / httpd-vhosts.conf
Created January 18, 2014 15:02
Confiurazione apache Virtual Hosts con hostname wildcard
NameVirtualHost *:80
LogLevel debug
#RewriteLog logs/rewrite_log
#RewriteLogLevel 9
<VirtualHost *:80>
UseCanonicalName Off
ServerName *.dev.local
VirtualDocumentRoot /Users/rbutti/Sites/httpd/%0/public
@roberto-butti
roberto-butti / .zshrc
Created January 18, 2014 15:09
file configurazione zshrc Zshell
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Example aliases
@roberto-butti
roberto-butti / merge_image.sh
Created January 15, 2016 15:21
Script per la sovrapposazione di N immagini con trasparenza
COUNTER=1
for currentfile in $(ls Productname*.png); do
if [ $COUNTER == 1 ]; then
cp $currentfile prova_$COUNTER.png
else
composite $currentfile prova_$(expr $COUNTER - 1).png prova_$COUNTER.png
fi
COUNTER=$(expr $COUNTER + 1)
done
@roberto-butti
roberto-butti / stats_2016_01.json
Last active February 2, 2016 19:53
Statistiche utilizzo Browser gennaio 2016
{
"Chrome 47.0": "23.69",
"Chrome for Android": "16.39",
"Safari iPhone": "7.03",
"IE 11.0": "6.23",
"Firefox 43.0": "5.76",
"Android 0": "4.83",
"Opera 0": "4.04",
"Safari iPad": "3.22",
"Chrome 48.0": "2.41",