Skip to content

Instantly share code, notes, and snippets.

View matteocrippa's full-sized avatar

Matteo Crippa matteocrippa

View GitHub Profile
@matteocrippa
matteocrippa / debug.php
Created October 1, 2015 14:48
SoapClient debug XML request and response
class SoapClientDebug extends SoapClient
{
public function __doRequest($request, $location, $action, $version, $one_way = NULL)
{
echo $request;
$resp = parent::__doRequest($request, $location, $action, $version);
echo $resp;
@matteocrippa
matteocrippa / ios-apns-how-to
Created April 18, 2013 13:13
iOS Push Notification Certificates - How to create
1- Open your OSX keychain
2- Click on Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority
3- Set a readable common name (eg. NameApp DEV o NameApp PROD according the certificate your are creating)
4- Select Save to disk
5- Proceed uploading to Apple portal and download the .CER file
@matteocrippa
matteocrippa / mysql-create-database.sql
Created April 18, 2013 13:29
Mysql Database Creation - CLI How To
CREATE DATABASE dbName;
GRANT ALL PRIVILEGES ON dbName.* TO user@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;
@matteocrippa
matteocrippa / gist:5442206
Created April 23, 2013 09:41
Mysql Backup & Restore
# BACKUP
mysqldump -u root -p<pass> <dbname> > <dbname>.sql
# RESTORE
mysql -u root -p<pass> <dbname> < <dbname>.sql
@matteocrippa
matteocrippa / gist:5458820
Last active December 16, 2015 15:49
Nginx - Create base configuration for a php website
# 1 - Use vi/vim/nano to create a file according the domain name
sudo vi /etc/nginx/sites-available/example.com
# 2 - add these lines inside:
server {
server_name example.com www.example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
@matteocrippa
matteocrippa / gist:5465999
Created April 26, 2013 09:18
Nginx - Redirect a domain with 301 to another domain
server {
# set the domain name this rule will work for
server_name tld.domain.ext;
# i force to listen to port 80
listen 80;
# no root, directly the redirect
rewrite ^ http://www.newdomain.com$request_uri? permanent;
}
@matteocrippa
matteocrippa / gist:5706396
Created June 4, 2013 14:34
CouchDB Backup
- copy all db files in your home
cp /var/lib/couchdb/<version>/* /home/username
- copy all files to actual server
scp -r -P <PORT> <username>@<ip>:/home/username .
- copy back to new server
- set permissions
chown couchdb *.couch
@matteocrippa
matteocrippa / gist:8416990
Created January 14, 2014 11:40
Mac OSX burn bootable ISO on USB thumb drive
# if your source is a iso file you have to convert to img first
hdiutil convert -format UDRW -o target.img original.iso
# then you have to figure out your USB device node
diskutil list
# plug in your usb thumb
diskutil list
# you will figure out that a new node is inside the list now, note down its name (eg. /dev/disk2 )
@matteocrippa
matteocrippa / gist:5458844
Last active February 19, 2016 16:57
Nginx - Wordpress with fast_cgi cache setup
# remember to download Nginx helper plugin [ http://wordpress.org/extend/plugins/nginx-helper/ ] for wordpress and install it
# create a new website configuration like this
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:500m inactive=60m;
server {
server_name example.com www.example.com;
access_log /var/www/domain.ext/logs/access.log;
@matteocrippa
matteocrippa / MacProWindows.md
Last active August 19, 2016 08:27
Mac Pro 5.1 install Windows 10 & macOS

Install Windows & macOS

Create bootable USB for Windows If not working, open Info.plist file, then edit PreUSBBootSupportedModels with USBBootSupportedModels

Create 2 partition in your SSD both for OS X

In Windows delete all partition except for EFI, create a new partition 40GB for windows Install Windows