Skip to content

Instantly share code, notes, and snippets.

Avatar

Lucas Serafim lslucas

View GitHub Profile
View wmlabs temp.sh
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
View Howto convert a PFX to a seperate .key & .crt file
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 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/id_rsa.pub

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

Now, rsync

View digitalocean.md

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@123.123.123.123

Add ssh fingerprint and enter password provided in email

@lslucas
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
#Source: http://codingfreak.blogspot.ca/2010/01/iptables-rate-limit-incoming.html
@lslucas
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
lslucas / git
Created Sep 16, 2013
GIT Useful commands
View git
#alternative to .gitignore
git update-index --assume-unchanged path/to/file
@lslucas
lslucas / backup-mysql.php
Created Sep 16, 2013
Download a backup of entire database.
View backup-mysql.php
<?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 Sep 6, 2013
Pure CSS Modal
View modal.md
#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.