Skip to content

Instantly share code, notes, and snippets.

View cryptojuice's full-sized avatar

Nick Robinson cryptojuice

  • Intuit
  • New York, NY
View GitHub Profile

Flask + uWSGI + nginx Primer

I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

How this shit works

  • Flask is managed by uWSGI.
  • uWSGI talks to nginx.
@cryptojuice
cryptojuice / A-Pen-by-Nick-Robinson.markdown
Created August 27, 2013 04:10
A Pen by Nick Robinson.
@cryptojuice
cryptojuice / gist:7670226
Created November 27, 2013 03:24
Simple nginx configuration. proxy to gunicorn.
user nobody nogroup;
worker_processes 1;
pid /var/run/nginx.pid;
error_log /var/log/nginx/error.log;
events {
worker_connections 1024;
accept_mutex off;
}

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
set -g default-terminal "screen-256color"
set -g history-limit 100000
# use VI
set-window-option -g mode-keys vi
set -g mode-keys vi
# Use ctrl-e instead of ctrl-b
set -g prefix C-e
unbind C-b
@cryptojuice
cryptojuice / index.coffee
Created May 18, 2014 13:31
Phantomjs render pdf to /dev/stdout
spawn = require('child_process').spawn
express = require('express')
app = express()
generatePDF = (callback) ->
child = spawn('phantomjs', [__dirname+'/render.coffee'])
child.stdout.on 'data', (data) ->
callback(null, data)
child.stdout.on 'error', (err) ->
callback(err)
@cryptojuice
cryptojuice / .tmux.conf
Created January 26, 2015 00:15
.tmux.conf
set -g default-terminal "screen-256color"
set -g history-limit 100000
# use VI
set-window-option -g mode-keys vi
set -g mode-keys vi
# Use ctrl-e instead of ctrl-b
set -g prefix C-e
unbind C-b
Resource.h
----------
@interface Resource : NSObject
+ (void)save:(NSError **)error;
@end
Resource.m
----------
@implementation Resource
+ (void)save:(NSError **)error {
# This is a configuration file for ProGuard.
# http://proguard.sourceforge.net/index.html#manual/usage.html
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
# Optimization is turned off by default. Dex does not like code run
# through the ProGuard optimize and preverify steps (and performs some
# of these optimizations on its own).
-dontoptimize
-dontpreverify
syntax enable
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'