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 random | |
import math | |
multipliers = (0.5, 0.8, 0.95, 0.99, 0.995) | |
values = [1] * len(multipliers) | |
for x in xrange(400): | |
numberline = ["-"] * 101 | |
for index, multiplier in enumerate(multipliers): | |
if index == 0: |
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
# These functions will allow you to | |
# - Read in Prison Architect save files | |
# - Modify the read content | |
# - Save content back into Prison Architect save file formats | |
import re | |
from collections import OrderedDict | |
from pprint import PrettyPrinter |
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
// Initial definitions | |
var now = new Date().getTime(); | |
var ten_seconds = 10 * 1000; | |
var one_day = 86400 * 1000; | |
var one_week = one_day * 7; | |
// Remove any pre-existing summary elements | |
jQuery(".summary-element").remove(); |
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
#!/usr/bin/python | |
import unicodecsv | |
import argparse | |
import sys | |
import re | |
from pysrt import SubRipFile | |
# Determine which languages to import | |
parser = argparse.ArgumentParser() | |
parser.add_argument("source", help="source language file to parse") |
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
#!/usr/bin/python | |
import unicodecsv | |
import sys | |
import argparse | |
import re | |
parser = argparse.ArgumentParser() | |
parser.add_argument("source", help="Source language file") | |
parser.add_argument("target", help="Target language file") | |
args = parser.parse_args() |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
from bs4 import BeautifulSoup | |
import random | |
import collections | |
import argparse | |
import json | |
import re | |
import requests | |
import sqlite3 |
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
/* Initial definitions */ | |
var regex_positive = /(france|french|paris|bonjour|salut|montr.al)/i; | |
var regex_negative = /(china|korea|spain|japan|taiwan|venezuela|costa rica|chile|vietnam|russia|honduras|brazil|iran|m.xico|czech|sweden|saudi|turkey|germany|india|argentina|colombia|netherlands|philippines)/i; | |
var now = new Date().getTime(); | |
var ten_seconds = 10 * 1000; | |
var one_day = 86400 * 1000; | |
var one_week = one_day * 7; | |
/* Clear junk from the page */ | |
jQuery("#chapterHeader, p").remove(); |
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 ast | |
import operator as op | |
# Supported tokens and their operators | |
operators = { | |
ast.Add: op.add, | |
ast.Sub: op.sub, | |
ast.Mult: op.mul, | |
ast.Div: op.truediv, | |
} |
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 memcache | |
from hashlib import sha1 | |
from datetime import datetime | |
cache = memcache.Client(["127.0.0.1:11211"]) | |
class ActionThrottled(Exception): | |
pass | |
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 datetime import timedelta | |
from django.core.cache import cache | |
from hashlib import md5 | |
from importlib import import_module | |
from random import randint | |
from redis import Redis | |
from rq import Queue | |
EXPIRY_VARIANCE = 0.2 |
OlderNewer