This document has now been incorporated into the uWSGI documentation:
http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html
Steps with explanations to set up a server using:
#!/usr/bin/python | |
''' | |
©2012 Paul Castle | |
Very crude but functional early edition, will expand in the future. | |
I run this script on a 3 day cron to keep my personal wiki backed up to my | |
local development server. LFTP is very good at retaining permissions between | |
mirrors. | |
User/pass variables require base64 encoded attributes to avoid shoulder-surfers. |
""" Unsupervised evaluation metrics. """ | |
# License: BSD Style. | |
from itertools import combinations | |
import numpy as np | |
from sklearn.utils import check_random_state | |
from sklearn.metrics.pairwise import distance_metrics | |
from sklearn.metrics.pairwise import pairwise_distances |
// 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, |
#Things Swimming in My Head
Over Labor Day Weekend, Twitter user @VXDS flew off his handle (so sorry) and made history. British Airways had lost his bag amd had been negligent in responding. Without the following to start a viral outcry over poor customer service, @XVDS did what any rational person would: he bought a promoted tweet and lamabasted the company for customer services.
The incident brings to mind a famous study in behavioral economics. In an experiment published in the Journal of Psychology, researchers gave people the chance to penalize teammates in a game for ruining the chance for the team to make money. Invariably, they did. The research flies in the face of classical economic assumption about Homo Economicus, ie the purely self-interested man. People are willing to spend their own capital in order to enforce social norms.
One prerequisite for a healthy city neighborhood, writes Jane Jacobs, is the presence of public spaces
#! /usr/bin/env python | |
""" | |
Python metaclasses | |
================== | |
A metaclass is a class factory; metaclasses serve two purposes: | |
1. replace ``type`` as the base class metatype for classes with the | |
``__metaclass__`` attribute |
import urllib2 | |
import re | |
import sys | |
from collections import defaultdict | |
from random import random | |
""" | |
PLEASE DO NOT RUN THIS QUOTED CODE FOR THE SAKE OF daemonology's SERVER, IT IS | |
NOT MY SERVER AND I FEEL BAD FOR ABUSING IT. JUST GET THE RESULTS OF THE | |
CRAWL HERE: http://pastebin.com/raw.php?i=nqpsnTtW AND SAVE THEM TO "archive.txt" |
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.spatial import Voronoi | |
def voronoi_finite_polygons_2d(vor, radius=None): | |
""" | |
Reconstruct infinite voronoi regions in a 2D diagram to finite | |
regions. | |
Parameters |
import pyaudio | |
import wave | |
FORMAT = pyaudio.paInt16 | |
CHANNELS = 2 | |
RATE = 44100 | |
CHUNK = 1024 | |
RECORD_SECONDS = 5 | |
WAVE_OUTPUT_FILENAME = "file.wav" | |