Skip to content

Instantly share code, notes, and snippets.

View brpaz's full-sized avatar

Bruno Paz brpaz

View GitHub Profile
@brpaz
brpaz / tmux-cheatsheet.md
Last active August 29, 2015 14:02 — forked from MohamedAlaa/tmux-cheatsheet.markdown
Tmux cheatsheet #tmux

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@brpaz
brpaz / mysql_to_s3.md
Last active August 29, 2015 14:08 — forked from oodavid/README.md
How to Backup mySQL to S3 #s3 #mysql #backup

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

@brpaz
brpaz / netstat_number_of_conn.md
Last active August 29, 2015 14:08 — forked from ellman/gist:8576781
Count number of connections to specific port using NETSTAT #linux #networking
netstat -anp | grep -w <PORT> | grep ESTABLISHED | wc -l
@brpaz
brpaz / mysqldump_ssh.md
Last active August 29, 2015 14:08 — forked from kirkegaard/dumpoverssh.sh
pipe a mysql dump through gzip and send it over ssh #ssh #gzip #mysql

mysqldump -u MYSQL_USERNAME -p YOUR_DATABASE | gzip -c | ssh USERNAME@YOUR_TO_HOST 'cat > ~/dump.sql.gz'

@brpaz
brpaz / html5-starter.html
Last active August 29, 2015 14:08 — forked from grevory/html5-starter.html
#html5 #boilerplate
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HTML5 Starter Template</title>
<meta name="description" content="Starter Template">
<meta name="author" content="Gregry Pike">
<link rel="stylesheet" href="css/styles.css?v=1.0">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
@brpaz
brpaz / CSS3 Media Queries Template
Last active August 29, 2015 14:08
#css #responsive #media-query
/*
* Author: http://stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries/
*/
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
@brpaz
brpaz / mysql_export_csv.sh
Created November 2, 2014 10:38 — forked from JoshuaEstes/gist:6831131
mysql export table into CSV file #mysql #csv
mysql -u USERNAME -p DATABASE -e "select * from TABLE;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g'
@brpaz
brpaz / deploy_user.sh
Last active August 29, 2015 14:08 — forked from JoshuaEstes/user.sh
creates a deploy user #linux #deploy
# Remote Server
useradd www-deploy -c "Deployment User" -d /home/www-deploy -G www-data -m -s /bin/bash
sudo su - www-deploy
# Localhost
ssh-keygen -t rsa
# Append your key to the Remote host authorized keys file
cat id_rsa.pub >> ~/.ssh/authorized_keys
@brpaz
brpaz / doctrine.distance_function.php
Last active August 29, 2015 14:08 — forked from Koc/gist:3016704
Doctrine2 DISTANCE function #doctrine #function
<?php
namespace Myako\Geographical\Functions;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
/**
* "DISTANCE" "(" LatitudeFrom, LongitudetFrom, LatitudeTo, LongitudeTo ")"
*
@brpaz
brpaz / php.openssl_crypt.php
Created November 4, 2014 21:53 — forked from WietseWind/crypt.php
Private Key descryption, Cert encryption using PHP #php
<?php
/**
* openssl genrsa -des3 -out server.key 2048
* -- Optioneel (anders: passphrase gebruiken) openssl rsa -in server.key -out server.key.insecure
* openssl req -new -key server.key -out server.csr
* openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
*/
function EncryptData($source){