Steps with explanations to set up a server using:
- virtualenv
- Django
- nginx
- uwsgi
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 1, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "from datetime import datetime" | |
| ] |
| """ | |
| Some solutions for @bobuk's problem discussed in | |
| http://www.radio-t.com/p/2014/10/18/podcast-414/ | |
| """ | |
| import random | |
| L_TEST = [1234, 1, 23, 252, 13523, 829, 2378, 234555, 912394] | |
| K_TEST = 3 |
| db.zips.aggregate([ | |
| {$project: | |
| { | |
| first_char: {$substr : ["$city",0,1]}, | |
| pop: 1 | |
| } | |
| }, | |
| {$match: | |
| { | |
| first_char: {$lt: 'A'} |
| db.grades.aggregate([ | |
| {$unwind: '$scores'}, | |
| {$match: | |
| {"scores.type": {$in: ["exam", "homework"]}}}, | |
| {$group: | |
| { | |
| _id: { | |
| 'student_id': '$student_id', | |
| 'class_id': '$class_id' | |
| }, |
| #! /usr/bin/env python | |
| """ | |
| Take screenshots every SLEEP_TIME seconds. | |
| """ | |
| import time | |
| import subprocess | |
| SLEEP_TIME = 10 | |
| COMMAND = "import -window root -format png data/{timestamp}.png" |
| # assume the following directory structure where contents of doc/ | |
| # and source/ are already checked into repo., with the exception | |
| # of the _build directory (i,e. you can check in _themes or _sources | |
| # or whatever else). | |
| # | |
| # proj/ | |
| # source/ | |
| # doc/ | |
| # remove doc/_build/html if present |
| from lxml import objectify | |
| from exceptions import QueryRequired | |
| def request(query=None, file_name=None): | |
| """ | |
| Makes a request to CGHub web service or gets data from a file. | |
| Returns parsed Response object. | |
| """ |
| import xml.dom.minidom | |
| from exceptions import QueryRequired | |
| import experiment | |
| import analysis | |
| class Result(object): | |
| experiment_xml = None | |
| analysis_xml = None | |
| pass |