Skip to content

Instantly share code, notes, and snippets.

@mplewis
mplewis / flask-uwsgi-nginx-primer.md
Last active August 3, 2025 16:54
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.

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.
@meskarune
meskarune / weather.py
Created June 10, 2013 21:54
Get weather data using Wunderground API
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())
@mjhea0
mjhea0 / 1 - sql_interview_questions.md
Last active June 22, 2024 09:44
Jitbit's SQL interview questions
@boates
boates / testClassificationModel.py
Last active January 16, 2019 01:37
For running sklearn classification algorithms easily on pandas data frame. Also perform tests on model accuracy.
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)
@kyledseever
kyledseever / prefix.php
Created June 29, 2012 00:35
Group Strings By Prefix
<?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;
@benwah
benwah / mongo_serialize.py
Created June 28, 2012 04:43
Queryset / List of queryset serializer for mongoengine models.
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):
"""
@tsabat
tsabat / zsh.md
Last active September 25, 2025 08:15
Getting oh-my-zsh to work in Ubuntu