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 os | |
import time | |
from pprint import pprint | |
def populate_board(x_size = 40, y_size = 40, density = .3): | |
''' build a board x X y size ''' | |
board =set() | |
population = x_size * y_size * density |
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
LOG = ''' | |
Tue Feb 24 00:00:02 2015 [11272386][-none-][FATAL] IBMDB2Manager: Persistent connection specified, but failed. Error: 42968: [IBM][CLI Driver] SQL8001N An attempt to connect to the database failed due to a product license problem. SQLSTATE=42968 SQLCODE=-8001 | |
Tue Feb 24 00:00:02 2015 [12517544][-none-][FATAL] IBMDB2Manager: Persistent connection specified, but failed. Error: 42968: [IBM][CLI Driver] SQL8001N An attempt to connect to the database failed due to a product license problem. SQLSTATE=42968 SQLCODE=-8001 | |
Tue Feb 24 00:00:02 2015 [11272386][-none-][FATAL] IBMDB2Manager: Could not connect to Database with non-persistent connection. Error 42968: [IBM][CLI Driver] SQL8001N An attempt to connect to the database failed due to a product license problem. SQLSTATE=42968 SQLCODE=-8001 | |
Tue Feb 24 00:00:02 2015 [11272386][-none-][FATAL] Could Not Connect:: Database Is Not Connected | |
Tue Feb 24 00:00:02 2015 [11272386][-none-][FATAL] Stack trace for DB_ERROR: | |
#0 custom/include/database/CustomIBM |
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 sys | |
from functools import wraps | |
from warnings import warn | |
class GeneratorContextManager(object): | |
"""Helper for @contextmanager decorator.""" | |
def __init__(self, gen): |
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 __future__ import absolute_import, division, print_function | |
# might make this work on py2 | |
from builtins import * | |
# Copyright (c) 2014, Varian Medical Systems, Inc. (VMS) | |
# All rights reserved. | |
# | |
# ximReader is an open source tool for reading .xim file (both compressed and uncompressed) | |
# HND compression algorithm is used to compress xim files. For a brief description of HND |
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 timeit | |
from random import shuffle, randrange | |
from functools import partial | |
from collections import deque | |
import time | |
def mean(al): | |
return sum(al)/len(al) |
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 pprint import pprint | |
data = { | |
"children": [ | |
{ | |
"id": 409, | |
"name": "Joe Bloggs", | |
"no_parent": "true" | |
}, |
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 __future__ import absolute_import, division, print_function | |
# might make this work on py2 | |
from builtins import * | |
# Copyright (c) 2014, Varian Medical Systems, Inc. (VMS) | |
# All rights reserved. | |
# | |
# ximReader is an open source tool for reading .xim file (both compressed and uncompressed) | |
# HND compression algorithm is used to compress xim files. For a brief description of HND | |
# compression algorithm please refer to the xim_readme.txt file. |
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 __future__ import absolute_import, division, print_function | |
# might make this work on py2 | |
from builtins import * | |
# Copyright (c) 2014, Varian Medical Systems, Inc. (VMS) | |
# All rights reserved. | |
# | |
# ximReader is an open source tool for reading .xim file (both compressed and uncompressed) | |
# HND compression algorithm is used to compress xim files. For a brief description of HND | |
# compression algorithm please refer to the xim_readme.txt file. |
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 random import choice | |
# reorganize into functions, main | |
def load_categoties() | |
with open('words/animals') as a: #Create the pool of words to be randomly chosen from, and split it up into categories. | |
animal_list = a.read().splitlines() | |
with open ('words/jobs') as b: | |
jobs_list = b.read().splitlines() |
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 collections import defaultdict | |
from pprint import pprint | |
class Effect(object): | |
def __init__(self, what, how): | |
self.what = what | |
self.how = how | |
def apply(self, base): |