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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from django.db import models, migrations | |
class Migration(migrations.Migration): | |
dependencies = [ | |
] |
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."> |
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
import collections | |
import pathlib | |
import sys | |
USAGE = """usage: {} path | |
displays number of files and total size per extension in the specified path.""" | |
def get_info(path): |
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
from lxml import etree | |
def clear_element(e): | |
e.clear() | |
while e.getprevious() is not None: | |
del e.getparent()[0] | |
def parse_file(filename): |
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
sudo apt-get install postgis postgresql-9.3-postgis-2.1 | |
sudo -iu postgres createuser proj123 -S -D -R | |
sudo -iu postgres createdb proj123 -O proj123 | |
sudo -iu postgres psql -c \"alter user proj123 with password 'proj123';\" | |
sudo -iu postgres psql proj123 -c \"CREATE EXTENSION postgis;\ | |
sudo -iu postgres psql proj123 -c \"CREATE EXTENSION postgis_topology;\"" | |
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
{% load staticfiles %} | |
<!doctype html> | |
<style> | |
#map { | |
height: 500px; | |
} | |
</style> | |
cool! |
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
LEAFLET_CONFIG = { | |
'SPATIAL_EXTENT': (30, 29, 36, 33.5), | |
# 'DEFAULT_CENTER': MAP_CENTER, | |
'DEFAULT_ZOOM': 8, | |
'TILES': [ | |
('OVI Satellite', | |
'http://maptile.maps.svc.ovi.com/maptiler/maptile/newest/satellite.day/{z}/{x}/{y}/256/png8', | |
'OVI maps'), |
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
def calc(s): | |
return 4 |
OlderNewer