Skip to content

Instantly share code, notes, and snippets.

View juliosmelo's full-sized avatar
🏠
Working from home

Julio Silveira Melo juliosmelo

🏠
Working from home
  • laboratoriohacker.com
  • Blue earth
View GitHub Profile
@juliosmelo
juliosmelo / fabfile.py
Created May 23, 2012 03:10
Fabric file for deploy django+gunicorn+nginx+virutalenv
View fabfile.py
import sys
from fabric.colors import green, yellow
from fabric.contrib.console import confirm
from fabric.context_managers import cd, prefix
from fabric.operations import prompt
from fabric.api import run, local, env, sudo
env.user = 'ubuntu'
env.hosts = ['0.0.0.0'] #ip do ec2
env.app_path = '/home/seu-usuario-do-ec2/bomgusto'
@juliosmelo
juliosmelo / gunicorn_initi.sh
Created March 7, 2013 00:25
Gunicorn startup script for Django projects.
View gunicorn_initi.sh
#!/bin/sh
ADDRESS='127.0.0.1'
PYTHON="<path_to_python>"
GUNICORN="<path_to_gunicorn>"
PROJECTPATH="<your_project_path>"
MANAGELOC="$PROJECTLOC/manage.py"
DEFAULT_ARGS="--workers=3 --daemon --bind=$ADDRESS:"
BASE_CMD="$GUNICORN $DEFAULT_ARGS"
View fabfile.py
# simples fabfile para aplicar o patch para o bug CVE-2014-6271
__author__ = 'juliomelo'
from fabric.api import *
from fabric.decorators import hosts
import re
env.use_ssh_config=True
@hosts('host_foo', 'host_bar')
@task
View UTF-8 to ASCII Python
from unicodedata import normalize
nome = u'Júlio Mélo'
novo_nome = normalize('NFKD', nome).encode('ASCII', 'ignore')
print(novo_nome)
'Julio Melo'
View keybase.md

Keybase proof

I hereby claim:

  • I am juliosmelo on github.
  • I am juliocsmelo (https://keybase.io/juliocsmelo) on keybase.
  • I have a public key whose fingerprint is 2463 D5C4 826C 2B25 E9F8 8B40 0736 13C4 6A88 8C5F

To claim this, I am signing this object:

@juliosmelo
juliosmelo / apache2.conf
Created September 23, 2015 16:14
LogFormat for proxy with x-forward-for
View apache2.conf
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" proxy
@juliosmelo
juliosmelo / install-comodo-ssl-cert-for-nginx.rst
Created October 15, 2015 14:00 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.
View install-comodo-ssl-cert-for-nginx.rst

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@juliosmelo
juliosmelo / ubuntu-compass-ruby
Created April 16, 2016 01:06 — forked from stephanetimmermans/ubuntu-compass-ruby
Install Compass+Ruby on Ubuntu 14.04
View ubuntu-compass-ruby
#https://gorails.com/setup/ubuntu/14.04
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.1.2
rvm use 2.1.2 --default
View Nginx for wodpress
upstream fpm_example.com1{
server unix:/var/run/php5-fpm.sock;
server unix:/var/run/php5-fpm1.sock;
keepalive 128;
}
upstream admin {
server unix:/var/run/php5-fpm1.sock;
server unix:/var/run/php5-fpm2.sock;
keepalive 128;
}
View Brazil geoJSON
This file has been truncated, but you can view the full file.
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": { "UF_05": "AC", "MICRO": "BRASILEIA", "MESO": "VALE DO ACRE", "REGIAO": "Norte", "NOME_UF": "Acre", "GEOCODIGO": "12" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -73.800983150850584, -7.111457753361378 ], [ -73.737625150791587, -7.134317253382619 ], [ -72.90061215001208, -7.436948253664468 ], [ -72.588010149720958, -7.550250253770059 ], [ -72.3029271494554, -7.584564753801942 ], [ -72.168962149330582, -7.600226253816572 ], [ -71.957814649133979, -7.624874753839549 ], [ -71.381112148596912, -7.691940753901918 ], [ -71.087928648323896, -7.725894253933575 ], [ -70.515258647790461, -7.791927253995141 ], [ -70.132605647434161, -7.83582675403602 ], [ -70.051806147358889, -7.847003754046341 ], [ -69.801148147125446, -8.060750754245419 ], [ -69.442709146791572, -8.366957254530575 ], [ -69.212413146577092, -8.56399675471414 ], [ -68.9223356463070