This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%pylab inline | |
BRUSH_STROKE_SIZE = 4 | |
palette = imread('palette.png') | |
image = imread('starry-night-800.jpg') | |
png = np.ones(image.shape) | |
num_of_strokes = [1000, 10000, 100000] | |
for num in num_of_strokes: | |
for index in range(num): | |
row = np.random.randint(0, png.shape[0]-4) | |
column = np.random.randint(0, png.shape[1]-4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="random_groups2.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import itertools | |
from time import sleep | |
from random import random | |
def main(): | |
c = Container(value=0) | |
adders = [threading.Thread(target=lambda x: x.add(1), args=(c,)) | |
for _ in xrange(10000)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Iframe(object): | |
def __init__(self, prm): | |
self.param = prm | |
def __call__(self, view): | |
def df(*args, **kwargs): | |
for i in args: | |
if type(i) == WSGIRequest: | |
host = i.META['HTTP_REFERER'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Occupation(models.Model): | |
event = models.ForeignKey(Event, related_name='sections') | |
section = models.ForeignKey(Section) | |
expected_capacity = models.PositiveIntegerField( | |
help_text=) | |
def __unicode__(self): | |
return self.section.name | |
class OccupationForm(forms.ModelForm): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | |
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title>Telostats</title> | |
<meta name="description" content="Tel Aviv municipal bike service (tel-o-fun) statistics and visualizations."> |