This file contains hidden or 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 re | |
# Supported tokens and their operations | |
ORDER_OF_OPERATIONS = ["MULTIPLY", "DIVIDE", "ADD", "SUBTRACT"] | |
scanner = re.Scanner([ | |
(r"([0-9]+)", lambda x, y: int(y)), | |
(r"\+", lambda x, y: "ADD"), | |
(r"-", lambda x, y: "SUBTRACT"), | |
(r"\*", lambda x, y: "MULTIPLY"), | |
(r"/", lambda x, y: "DIVIDE"), |
This file contains hidden or 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 hidden or 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 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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") |
NewerOlder