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.
- Flask is managed by
uWSGI. uWSGItalks tonginx.
| #You may have to tweak some things here | |
| CC = gcc | |
| CXX = g++ | |
| FLAGS = -I/usr/include/python2.7 | |
| CFLAGS = | |
| CXXFLAGS = | |
| LDFLAGS = | |
| #Do not change anything beyond this point | |
| CXXFLAGS += -std=c++11 |
| // Just before switching jobs: | |
| // Add one of these. | |
| // Preferably into the same commit where you do a large merge. | |
| // | |
| // This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
| // and then it quickly escalated into more and more evil suggestions. | |
| // I've tried to capture interesting suggestions here. | |
| // | |
| // Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
| // @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
| #include "tuple_ops.h" | |
| template<typename T> | |
| void print_tuple(const T& x) | |
| { | |
| std::cout << "Head:" << Car(x) << " Remaining:" << std::tuple_size<T>::value - 1 << std::endl; | |
| } | |
| int main(int argc, const char* argv[]) | |
| { |
| #define USE_ROBIN_HOOD_HASH 1 | |
| #define USE_SEPARATE_HASH_ARRAY 1 | |
| template<class Key, class Value> | |
| class hash_table | |
| { | |
| static const int INITIAL_SIZE = 256; | |
| static const int LOAD_FACTOR_PERCENT = 90; | |
| struct elem |
| ;; assume filename is same as classname | |
| (defun get-class-name () | |
| (file-name-nondirectory (file-name-sans-extension buffer-file-name))) | |
| ;; insert it interactively | |
| (defun insert-class-name () | |
| (interactive) | |
| (insert (get-class-name))) |
| //------------------------------------------------------------------------------ | |
| // pdbdump.c - dump symbols from .pdb and executable files (public domain). | |
| // - to compile; cl.exe /Ox /Zi pdbdump.c | |
| // - | |
| // - Martin Ridgers, pdbdump 'at' fireproofgravy.co.uk | |
| //------------------------------------------------------------------------------ | |
| #include <stdio.h> | |
| #include <Windows.h> | |
| #include <DbgHelp.h> |
| D [0-9] | |
| L [a-zA-Z_] | |
| H [a-fA-F0-9] | |
| E ([Ee][+-]?{D}+) | |
| P ([Pp][+-]?{D}+) | |
| FS (f|F|l|L) | |
| IS ((u|U)|(u|U)?(l|L|ll|LL)|(l|L|ll|LL)(u|U)) | |
| %{ | |
| #include <stdio.h> |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs