Skip to content

Instantly share code, notes, and snippets.

@salgua
salgua / publish.sh
Created June 28, 2019 10:45
Magento 2 rapid deployment - from local to remote server
#!/usr/bin/env bash
# Author: Salvatore Guarino - [email protected]
# Instructions:
#
# 1. Manually rsync the local Magento 2 folder on the remote server.
# 2. Change the Mysql DB settings on app/etc/env.php on the remote server.
# 3. Copy the script on your local Magento 2 folder
# 4. Change variables according to your local and remote environment
@salgua
salgua / README.txt
Last active November 16, 2017 14:14
Use Raspberry as RS232 gateway (with USB adapter)
# on Raspberry Pi
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install ser2net
# check if /dev/ttyUSB0 exist
sudo echo "2000:raw:600:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner" >> /etc/ser2net.conf
sudo service ser2net restart
@salgua
salgua / unifi-raspberry_pi-instructions.sh
Last active October 3, 2017 16:21 — forked from bwbaugh/unifi-raspberry_pi-instructions.sh
Installing Ubiquiti UniFi Controller 5 on Raspberry Pi.
# Mirror of the instructions available here:
# http://www.lowefamily.com.au/2016/06/02/installing-ubiquiti-unifi-controller-5-on-raspberry-pi/
#
# These commands CANNOT be run in a script.
# They're just for reference.
# Install on Raspbian Jessie, or upgrade from Wheezy.
# Make sure all packages are upgraded (update && upgrade).
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
Enable-RemoteDesktop
cinst notepadplusplus
cinst 7zip
cinst adobereader
cinst skype
cinst pdfcreator
cinst firefox
cinst chrome
@salgua
salgua / gist:30ee2bc205d71f758fd9
Created December 5, 2014 11:34
Woocommerce COD only for specific country with specific shipment rate
//enable COD only for italy
function payment_gateway_disable_country( $available_gateways ) {
global $woocommerce;
if ( isset( $available_gateways['cod'] ) && $woocommerce->customer->get_country() <> 'IT' ) {
unset( $available_gateways['cod'] );
}
//make COD the only available gateway for flat_rate shipping method (or other unused method)
//you can use the label cash on delivery for flat_rate and determining the shipping cost for COD
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
@salgua
salgua / gist:5038995
Last active December 14, 2015 05:59
with this MySQL query you can extract rows that contain in the field "textfield1" only uppercase words
#with this query you can extract rows that contain in the field "textfield1" only uppercase words
SELECT * FROM t1 WHERE BINARY textfield1 = ucase(textfield1)
@salgua
salgua / gist:844580
Created February 25, 2011 21:59
prova
<?php
echo "Hello world";
?>