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
>+<+[>>>[-]<[-]<[>+>+<<-]>>[<<+>>-]<[>[-]>>>>>>>[-]+>>>[-]<<<[>>>+<<<-]>>>[>>[-]<<-[>>+<<-]+>>]>[<<<[<<]>+>[>>]>-]<<<[<<]>[<<+<<<<<<<+>>>>>>>>>-]<<<<<<<<<[>>>>>>>>>+<<<<<<<<<-]>>>>>>>>>>[>>]>[-]<<<[<<]>[>[>>]>+<<<[<<]>-]>-<<<<<<<<<<[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]++<<<<<<<<<<<<<<<<<<<<<<<<[<<<<<<+>>>>>>-]<<<<<<[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-]>-]<[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]+[<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<-]>>>>>>>>>>>>>>>>>>>>>>>>>>>[>>[-]<<-[>>+<<-]+>>]>[<<<[<<]>+>[>>]>-]<<<[<<]>[<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[>>>> |
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 <Foundation/Foundation.h> | |
@interface TextProcessor : NSObject { | |
NSLinguisticTagger* tagger; | |
} | |
- (id) initWithLanguage:(NSString*) language; | |
- (void) setString:(NSMutableString*) str; | |
- (NSRange) expandToSentenceBreak:(NSRange) original; | |
- (void) stringEditedInRange:(NSRange) range changeInLength:(NSInteger) delta; | |
- (void)enumerateTagsInRange:(NSRange)range scheme:(NSString *)tagScheme options:(NSLinguisticTaggerOptions)opts usingBlock:(void (^)(NSString *tag, NSRange tokenRange, NSRange sentenceRange, BOOL *stop))block; |
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
xindent = str(11.553572) | |
ystart = 894.94238 | |
incr = 907.44238 - 894.94238 | |
def lines(text): | |
words = text.split() | |
result = "" | |
currentLeg = "" | |
count = 0 | |
for w in 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 sys import argv | |
import os | |
import csv | |
import re | |
import subprocess | |
xindent = str(11.553572) | |
ystart = 894.94238 | |
incr = 907.44238 - 894.94238 |
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 pyparsing import * | |
from collections import namedtuple | |
Entry = namedtuple("Entry", "description path section") | |
__currentsection = None | |
def __section(section): | |
global __currentsection | |
__currentsection = section.Section |
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 linecache | |
import math | |
def wordhash(hash, wordlist="all.short", address_size=4): | |
words = [] | |
for i in range(0, len(hash), address_size): | |
hx = "00" | |
try: | |
hx = hash[i:i+address_size] | |
except IndexError as err: |
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 EffectCompose(EffectMeta): | |
def __init__(cls, name, bases, dct): | |
super().__init__(name, bases, dct) | |
def compose(a,b,abort_on_fail=False): | |
if not a: | |
return b | |
if abort_on_fail: | |
def f(statecont, *args, **kwargs): | |
res = a(statecont) | |
if res.opstate: |
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 | |
def lift_to_module(module_name, types): | |
"""Take a list of dynamically generated types, or anything really, | |
and lift them to the root level of the module. | |
I mostly use this when I do something like this: | |
>>> some_data_source = ["Foo", "Bar", "Goo"] | |
>>> types = [ | |
SomeMetaClass("TypeName"+ i, (object,), inputs) |
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
""" | |
>>> SomeEffect = Effect("SomeEffect", someFunc) | |
>>> OtherEffect = Effect("OtherEffect", someFunc) | |
>>> CompositeEffect = SomeEffect + OtherEffect | |
>>> newstate = CompositeEffect()(oldstate) | |
And we can generate effects, too: | |
>>> effects = [Effect("Do" + e.title(), funcGen(e)) for e in effectTypes] | |
This is the real strength of this snippet of code- generating variations of behaviors |
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 | |
choices = ["da","ja"] | |
truth = random.choice(choices) | |
false =[c for c in choices if c != truth] | |
false = false[0] | |
gods = [lambda: truth, lambda: false, lambda: random.choice(choices)] | |
a = random.choice(gods) | |
b = a | |
while b == a: | |
b = random.choice(gods) |
OlderNewer