Skip to content

Instantly share code, notes, and snippets.


Lucas Serafim lslucas

View GitHub Profile
View wmlabs
rpm -Uvh
yum remove php-common # Need to remove this, otherwise it conflicts
yum install php56w
yum install php56w-mysql
yum install php56w-common
yum install php56w-pdo
yum install php56w-opcache
php --version
sudo ssh-keygen -t rsa -b 4096 -C eishii1
View Howto convert a PFX to a seperate .key & .crt file
`openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]`
What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file.
Now let’s extract the certificate:
`openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]`
lslucas / gist:3103fd7447a58ddd12d9
Last active Dec 29, 2016
rsync - clone folder from one server to another
View gist:3103fd7447a58ddd12d9

On origin server

ssh-keygen -f ~/.ssh/id_rsa -q -P ""
cat ~/.ssh/

Copy and put that ssh key on destination server in (if don't exists, create it): ~/.ssh/authorized_keys

Now, rsync


Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@

Add ssh fingerprint and enter password provided in email

lslucas / iptables-security
Created Jun 22, 2014
iptables - Rate-limit incoming connections
View iptables-security
$ iptables -I INPUT -p tcp --dport 80 -m state --state NEW -m recent --set
$ iptables -I INPUT -p tcp --dport 80 -m state --state NEW -m recent --update --seconds 30 --hitcount 10 -j DROP
lslucas / file_exists.bash
Created Mar 6, 2014
Check if file exists in bash/terminal/unix
View file_exists.bash
[ -f /etc/hosts ] && echo "Found" || echo "Not found"
lslucas / git
Created Sep 16, 2013
GIT Useful commands
View git
#alternative to .gitignore
git update-index --assume-unchanged path/to/file
lslucas / backup-mysql.php
Created Sep 16, 2013
Download a backup of entire database.
View backup-mysql.php
backup_tables('localhost', 'DB_USER', 'DB_PASS', 'DB_DATABASE');
/* backup the db OR just a table */
function backup_tables($host,$user,$pass,$name,$tables = '*')
$link = mysql_connect($host,$user,$pass);
lslucas /
Created Sep 6, 2013
Pure CSS Modal
#modal {
    display: block;
    position: fixed;
    top: 50%;
    left: 50%;
    box-sizing: border-box;
    transform: translate(-50%, -50%);
You can’t perform that action at this time.