Skip to content

Instantly share code, notes, and snippets.

View thiagoguarnieri's full-sized avatar
💭
Always Available

Thiago Guarnieri thiagoguarnieri

💭
Always Available
View GitHub Profile
@thiagoguarnieri
thiagoguarnieri / spotify_token.php
Created March 22, 2016 13:51
Get Spotify Access Token (client credentials) with PHP and cURL
//based on https://gist.github.com/ahallora/4aac6d048742d5de0e65
$client_id = 'your client id';
$client_secret = 'your client secret';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://accounts.spotify.com/api/token');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
@thiagoguarnieri
thiagoguarnieri / installation.txt
Last active June 16, 2016 00:27
MongoDB PHP Installation and operation (Ubuntu 14.04)
#install mongo db
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install -y mongodb-org
#install pecl
sudo apt-get install php5-dev php5-cli php-pear
#requisites
@thiagoguarnieri
thiagoguarnieri / gist:8ede26bebd23944d63befbb0696b65c7
Created August 11, 2019 12:19
Using rsync to transfer a file from/to a server using two hop SSH
# Command used to send a file to a remote server B only reachable through a remote server A
# Local <----> A <----> B
# receive
rsync -av --append -e 'ssh -o "ProxyCommand ssh user@server_A exec nc %h %p 2>/dev/null"' user@server_B:/path/source.file destination.file
# send
rsync -av --append -e 'ssh -o "ProxyCommand ssh user@server_A exec nc %h %p 2>/dev/null"' destination.file user@server_B:/path/source.file
@thiagoguarnieri
thiagoguarnieri / samba.txt
Last active November 14, 2022 20:13
create simple share in samba for OPL
sudo apt-get install samba cifs-utils
#create samba user
sudo smbpasswd -a myuser
#configure samba
mousepad /etc/samba/smb.conf
[global]
client min protocol = NT1