Skip to content

Instantly share code, notes, and snippets.

View roberto-butti's full-sized avatar
🚀

Roberto Butti roberto-butti

🚀
View GitHub Profile
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:3509401
Created August 29, 2012 09:50
Snippet PHP , how to add product in cart and create order in Magento via SOAP API v1
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
$config=array();
$config["hostname"] = "my-hostname-with-magento.com";
$config["login"] = "soapuser";
$config["password"] = "soappassword";
$config["customer_as_guest"] = TRUE;
$config["customer_id"] = 261; //only if you don't want as Guest
@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 / 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,
@roberto-butti
roberto-butti / upgrade.sh
Last active September 16, 2019 09:27
upgrading php7 with MacPorts
#!/bin/bash
#update ports index
sudo port selfupdate
# install php version 7.0 :)
sudo port install php70
# install php 7 as apache module
sudo port install php70-apache2handler
cd /opt/local/apache2/modules
sudo /opt/local/apache2/bin/apxs -a -e -n php7 mod_php70.so
cd