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
.
# Rename an email address in all old commits. | |
# WARNING: Will change all your commit SHA1s. | |
# Based off of the script from here: | |
# http://coffee.geek.nz/how-change-author-git.html | |
git filter-branch -f --commit-filter ' | |
if [ "$GIT_COMMITTER_EMAIL" = "[email protected]" ]; | |
then | |
GIT_AUTHOR_EMAIL="[email protected]"; | |
GIT_COMMITTER_EMAIL="[email protected]"; | |
git commit-tree "$@"; |
This histogram shows the distribution of GitHub Gist API response times (in milliseconds) for a sample of 10,000 requests as observed by bl.ocks.org.
The distribution roughly follows a log-normal distribution, which is unsurprising for a complex process that has multiple independently-random sources of delay. The mode response time was in the range 120-140ms, while the median response time was 206ms. The middle 80% of requests were in the range 114-527ms. About 11% of requests took longer than 500ms, and 5% of requests took longer than one second. (The rightmost bin in the histogram includes these long requests.)
Since API endpoints vary dramatically in their computational cost, the distribution of response times is likely multimodal. In this dataset, 96% of requests were for a single gist (/gists/42
), while the remaining 4% of requests were to list a user’s gist (/users/fred/gists
). By separating the API requests for a single
import email | |
import email.parser | |
import imaplib | |
import getpass | |
def imap_login(username=None, password=None): | |
""" | |
login and return the connection | |
""" |
// https://gist.github.com/854622 | |
(function(window,undefined){ | |
// Prepare our Variables | |
var | |
History = window.History, | |
$ = window.jQuery, | |
document = window.document; | |
// Check to see if History.js is enabled for our Browser |
// changed the functions from .keys() -> ._keys(), likewise for .values() | |
// because .keys()/.values() breaks jQuery | |
Object.prototype._keys = function (i) { | |
var keys = Object.keys(this); | |
return (i >= 0) ? keys[i] : keys; | |
}; | |
Object.prototype._values = function (i) { | |
var self = this; |
var MixpanelLib = function (j, n, m) { | |
function k(a, c, b) { | |
if (a.length) { | |
var e; | |
for (e = 0; e < a.length; e++) c.call(b || c, a[e], e) | |
} else if (typeof a == "object") for (e in a) Object.hasOwnProperty.call(a, e) && c.call(b || c, a[e], e) | |
} | |
function z(a, c) { | |
a.prototype = new c; | |
a.prototype.constructor = a; |
# | |
# $> ruby load.rb http://data.githubarchive.org/2012-04-01-15.json.gz | |
# | |
require 'yajl' | |
require 'zlib' | |
require 'sqlite3' | |
require 'open-uri' | |
input = ARGV.shift |
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.
});
set background=dark | |
hi clear | |
if exists("syntax_on") | |
syntax reset | |
endif | |
let colors_name = "twilight" |