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
. uWSGI
talks tonginx
.
python test.py | |
Traceback (most recent call last): | |
File "test.py", line 10, in <module> | |
response = json.load(urllib.request.urlopen(request)) | |
File "/usr/lib/python3.3/json/__init__.py", line 274, in load | |
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) | |
File "/usr/lib/python3.3/json/__init__.py", line 319, in loads | |
return _default_decoder.decode(s) | |
File "/usr/lib/python3.3/json/decoder.py", line 352, in decode | |
obj, end = self.raw_decode(s, idx=_w(s, 0).end()) |
http://www.jitbit.com/news/181-jitbits-sql-interview-questions/
employees
def splitData(df, trainPerc=0.6, cvPerc=0.2, testPerc=0.2): | |
""" | |
return: training, cv, test | |
(as pandas dataframes) | |
params: | |
df: pandas dataframe | |
trainPerc: float | percentage of data for trainin set (default=0.6 | |
cvPerc: float | percentage of data for cross validation set (default=0.2) | |
testPerc: float | percentage of data for test set (default=0.2) | |
(trainPerc + cvPerc + testPerc must equal 1.0) |
<?php | |
// returns the position of the first differing character between | |
// $left and $right, or -1 if either is empty | |
function strcmppos($left, $right) { | |
if (empty($left) || empty($right)) { | |
return -1; | |
} | |
$i = 0; |
import json | |
import datetime | |
from decimal import Decimal | |
from mongoengine.queryset import queryset_manager | |
from mongoengine.queryset import QuerySet | |
from mongoengine.base import BaseList, BaseDict, ObjectId | |
def list_encoder(inst, obj, field, force_string=False): | |
""" |
Prereq:
apt-get install zsh
apt-get install git-core
Getting zsh to work in ubuntu is weird, since sh
does not understand the source
command. So, you do this to install zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh