Skip to content

Instantly share code, notes, and snippets.

View lslucas's full-sized avatar

Lucas Serafim lslucas

View GitHub Profile
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
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
source: http://www.markbrilman.nl/2011/08/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
lslucas / gist:3103fd7447a58ddd12d9
Last active December 29, 2016 15:17
rsync - clone folder from one server to another

On origin server

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

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 [email protected]

Add ssh fingerprint and enter password provided in email

@lslucas
lslucas / iptables-security
Created June 22, 2014 15:19
iptables - Rate-limit incoming connections
$ 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
#Source: http://codingfreak.blogspot.ca/2010/01/iptables-rate-limit-incoming.html
@lslucas
lslucas / file_exists.bash
Created March 6, 2014 18:49
Check if file exists in bash/terminal/unix
[ -f /etc/hosts ] && echo "Found" || echo "Not found"
@lslucas
lslucas / git
Created September 16, 2013 18:13
GIT Useful commands
#alternative to .gitignore
git update-index --assume-unchanged path/to/file
@lslucas
lslucas / backup-mysql.php
Created September 16, 2013 15:22
Download a backup of entire database.
<?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
lslucas / modal.md
Created September 6, 2013 14:39
Pure CSS Modal
#modal {
    display: block;
    position: fixed;
    top: 50%;
    left: 50%;
    box-sizing: border-box;
    transform: translate(-50%, -50%);
}