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 / nginx.symfony2.vhost
Created September 7, 2014 09:49
symfony2 virtualhost nginx configuration
server {
server_name domain.tld www.domain.tld;
root /var/www/project/web;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
}
location ~ ^/(app|app_dev|config)\.php(/|$) {
@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 / nginx.rewrite_path.md
Created October 28, 2014 22:29
Rewrites the path to diferent folder #nginx #nginx #rewrite
server {
    root /www/data;

    location / {
    }

    location /images/ {
    }
@brpaz
brpaz / nginx.reverse_proxy.md
Created October 28, 2014 22:32
#nginx #proxy
@brpaz
brpaz / nginx.disable_access_log.md
Created October 28, 2014 22:38
Disables the access log when accessing static files #nginx #log #access
location ~* \.(jpg|jpeg|gif|png|svg|css|js|ico|xml|ttf|otf|woff)$ {
    access_log        off;
    log_not_found     off;
}
@brpaz
brpaz / linux_find_command.md
Created October 29, 2014 21:55
#find #liinux

Find Files Using Name in Current Directory

Find all the files whose name is tecmint.txt in a current working directory.

find . -name tecmint.txt

@brpaz
brpaz / redirect_putput_sudo.md
Created October 31, 2014 19:52
redirect output with sudo #sudo #tee #linux #stdout

Run a shell with sudo and give the command to it by using the -c option:

sudo sh -c 'ls -hal /root/ > /root/test.out'

Use sudo tee (if you have to escape a lot when using the -c option):