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 time_left(self): | |
if self.completed: | |
return 0 | |
start = int(time.mktime(self.starttime.timetuple())) | |
now = int(time.mktime(datetime.datetime.now().timetuple())) | |
time_left = start + (settings.ATTACK_DURATION * 60) - now | |
if time_left > 0: | |
return time_left |
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 rand_color(): | |
return "#%06x" % (math.floor(random.randint(10000, 16777215))) |
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
bbox = Polygon.from_bbox((rect.x, rect.y, (rect.x + rect.width), (rect.y + rect.height))) | |
zipcodes = Zipcode.objects.filter(geom__intersects=bbox) |
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 fileinput | |
for file in files: | |
for n,line in enumerate(fileinput.FileInput(file, inplace=1)): | |
if n == 0: print "HEADER" | |
print line |
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 draw_tile(x, y, z): | |
# Create a blank, transparent tile | |
tile = Image.new("RGBA", (gmap.TILE_SIZE, gmap.TILE_SIZE), (0, 0, 0, 0)) | |
# Query for Zipcodess within bounding box | |
rect = gmap.getTileRect(x, y, z) | |
bbox = Polygon.from_bbox((rect.x, rect.y, (rect.x + rect.width), (rect.y + rect.height))) | |
zipcodes = Zipcode.objects.filter(geom__intersects=bbox) | |
# Draw polygons on tile |
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 draw_tile(x, y, z): | |
# Create a blank, transparent tile | |
tile = Image.new("RGBA", (gmap.TILE_SIZE, gmap.TILE_SIZE), (0, 0, 0, 0)) | |
# Query for Zipcodess within bounding box | |
rect = gmap.getTileRect(x, y, z) | |
bbox = Polygon.from_bbox((rect.x, rect.y, (rect.x + rect.width), (rect.y + rect.height))) | |
zipcodes = Zipcode.objects.filter(geom__intersects=bbox) | |
# Draw polygons on tile |
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 os | |
import sys | |
import re | |
class Station: | |
def __init__(self, file): | |
file = open(file, 'r') | |
self.data = { "obs": {} } | |
for line in file.readlines(): |
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
<?php | |
error_reporting(E_ALL); | |
ini_set("display_errors", 1); | |
require_once('../php/Commun/FUS_SCM_ini.php'); | |
require_once('../php/Commun/FUS_SCM_database.php'); | |
$o_db = db_connect($_db_host, $_db_user, $_db_passw); | |
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 os | |
alist = ["wtf", "i", "love", "this", "font"] | |
for lol in alist: | |
print lol |
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
<?php | |
error_reporting(E_ALL); | |
ini_set("display_errors", 1); | |
require_once('../php/Commun/FUS_SCM_ini.php'); | |
require_once('../php/Commun/FUS_SCM_database.php'); | |
$o_db = db_connect($_db_host, $_db_user, $_db_passw); |
OlderNewer