Skip to content

Instantly share code, notes, and snippets.

View lricoy's full-sized avatar

Lucas Ricoy lricoy

View GitHub Profile
@lricoy
lricoy / gunicorn_start
Last active December 26, 2015 04:29
gunicorn sample config file
#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=webadmin # the user to run as
GROUP=webadmin # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name
@lricoy
lricoy / hello.conf
Last active December 26, 2015 04:29
Supervisor sample config file
[program:hello]
command = /webapps/hello_django/bin/gunicorn_start ; Command to start app
user = webadmin ; User to run as
stdout_logfile = /webapps/hello_django/logs/gunicorn_supervisor.log ; Where to write log messages
redirect_stderr = true ; Save stderr in the same log
@lricoy
lricoy / gunicorn_start
Last active December 26, 2015 04:29
Nginx, gunicorn and supervisor sample config files
#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=webadmin # the user to run as
GROUP=webadmin # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name
@lricoy
lricoy / create_users.sh
Last active December 26, 2015 04:29
Ubuntu server setup (nbinx + gunicorn + supervisor + virtualenv)
adduser --gecos "" webadmin && adduser webadmin sudo
adduser --gecos "" lucas && adduser lucas sudo
curl https://gist.github.com/lricoy/7094059/download | tar zx && mv ./*gist* ./scripts && chmod +x ./scripts/*
@lricoy
lricoy / dict_to_obj.py
Created June 27, 2014 00:35
dict_to_obj.py
#coding: utf-8
class Dict2Obj(object):
"""
Turns a dictionary into a class
"""
def __init__(self, dictionary):
"""Constructor"""
for key in dictionary:
@lricoy
lricoy / oauthcallback.html
Last active August 29, 2015 14:12
Open Facebook Angular
<html>
<body>
<script>
window.opener.oauthCallback(window.location.href);
window.close();
</script>
</body>
</html>
@lricoy
lricoy / new_team.html
Last active October 14, 2015 13:54
New Team Page Foxus
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<base href="/">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="theme-color" content="#F44336">
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/0.11.2/angular-material.min.css">
@lricoy
lricoy / arrowFunctions.js
Last active March 23, 2016 01:52
ES2015 features
// Expressões (Expression bodies)
var odds = evens.map(v => v + 1);
var nums = evens.map((v, i) => v + i);
// Declarações (Statement bodies)
nums.forEach(v => {
if (v % 5 === 0)
fives.push(v);
});
@lricoy
lricoy / classes.js
Created March 23, 2016 01:47
ES2015 classes
// Declaração da classe
class Funcionario extends Pessoa {
// Método construtor
constructor(cargo) {
// Chama o construtor da classe Pessoa
super(cargo);
this.foo = 'foo';