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 | |
from random import choice | |
def get_dict_words(): | |
"""Get some words from local dict.""" | |
# Choices: web2, words, web2a, connectives, propernames | |
folder = 'words' |
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 as ppr | |
import nltk | |
def get_dict_words(): | |
# Choices: web2, words, web2a, connectives, propernames | |
folder = 'words' | |
osx_words = '/usr/share/dict/{}'.format(folder) | |
with open(osx_words, 'r') as wordfile: |
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
"""Specialized tuples.""" | |
def n_tuple(argcount): | |
"""Return a new function to generate a tuple. | |
But only if the specified arity is met. | |
""" | |
def _tuple(*someargs): | |
if len(someargs) != argcount: |
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
Joovfif Laav Puuhge | |
Diuse'Uoclu Bulvi | |
Veemza'Coogku Wiizzaq | |
Pecgad'Niqbej Livqic | |
Xad'Fecye Kodva | |
Ham-Wefqon Xuqqek | |
Zaance Vooqfe Ueehmuv | |
Raadzuc-Yiikheu Voow | |
Siijuu'Boomnaq Peen | |
Lervo Fuusi Sen |
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
# Make this folder import-able. |
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 SuperDict(): | |
def __init__(self, **kwargs): | |
self.items = dict(**kwargs) | |
def __getitem__(self, key): | |
if isinstance(key, tuple): | |
_curr = self.items | |
for num in key: | |
_curr = _curr[num] | |
return _curr |
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 flask import Flask | |
from flask.ext.restless import APIManager | |
import models | |
app = Flask(__name__) | |
app.config['DEBUG'] = True | |
manager = APIManager(app, session=models.session) | |
manager.create_api(models.Edge, methods=['GET', 'POST', 'PUT', 'DELETE']) |
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
"""A python runner for nodejs test files.""" | |
import os | |
import subprocess | |
import sys | |
def check_tests(): | |
"""Run all tests.""" | |
js_files = [f for f in os.listdir('.') if f.endswith('Spec.js')] |
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 flask import Flask | |
import settings | |
from service_a import svc_a as svc_a_bp | |
app = Flask('myapp') | |
if settings.SERVICES['serviceA'].enabled: | |
app.register_blueprint(svc_a_bp) |
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
{ | |
"data": { | |
"xs": { | |
"setosa": "setosa_x", | |
"versicolor": "versicolor_x" | |
}, | |
"columns": [ | |
["setosa_x", 3.5, 3.0, 3.2, 3.1, 3.6, 3.9, 3.4, 3.4, 2.9, 3.1, 3.7, 3.4, 3.0, 3.0, 4.0, 4.4, 3.9, 3.5, 3.8, 3.8, 3.4, 3.7, 3.6, 3.3, 3.4, 3.0, 3.4, 3.5, 3.4, 3.2, 3.1, 3.4, 4.1, 4.2, 3.1, 3.2, 3.5, 3.6, 3.0, 3.4, 3.5, 2.3, 3.2, 3.5, 3.8, 3.0, 3.8, 3.2, 3.7, 3.3], | |
["versicolor_x", 3.2, 3.2, 3.1, 2.3, 2.8, 2.8, 3.3, 2.4, 2.9, 2.7, 2.0, 3.0, 2.2, 2.9, 2.9, 3.1, 3.0, 2.7, 2.2, 2.5, 3.2, 2.8, 2.5, 2.8, 2.9, 3.0, 2.8, 3.0, 2.9, 2.6, 2.4, 2.4, 2.7, 2.7, 3.0, 3.4, 3.1, 2.3, 3.0, 2.5, 2.6, 3.0, 2.6, 2.3, 2.7, 3.0, 2.9, 2.9, 2.5, 2.8], | |
["setosa", 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.2, 0.4, 0.4, 0.3, 0.3, 0.3, 0.2, 0.4, 0.2, 0.5, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4, 0.1, 0.2, 0.2, 0.2, 0.2, 0.1, 0.2, 0.2, 0.3, 0.3, 0.2, 0.6, 0.4, 0.3, 0.2, 0.2, 0.2, 0.2], |