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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>fileTypes</key> | |
<array> | |
<string>bf</string> | |
</array> | |
<key>name</key> | |
<string>Befunge</string> |
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 argparse | |
import getpass | |
from os.path import exists | |
from os import makedirs | |
import requests | |
from robobrowser import RoboBrowser | |
import shutil | |
def parse_filename(url, number): | |
filename = url.split('/')[-1] |
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 bs4 import BeautifulSoup | |
import requests | |
def main(): | |
r = requests.get('http://www.soybomb.com/tricks/words/') | |
soup = BeautifulSoup(r.text, 'html.parser') | |
tags_with_words = soup.find_all('td') | |
for tag in tags_with_words: | |
if tag.string: | |
print(tag.string) |
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 textwrap | |
# Actual Boggle dice | |
dice = ['aspffk', | |
'tesois', | |
'ehgewn', | |
'atwtoo', | |
'uensie', | |
'itmuoc', |
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
""" notes coroutine box handler: using a coroutine to save state for repeated box rendering | |
* Box renders input, rolls over to new lines when it hits the end. | |
* Box uses arrow keys to update size | |
* the box_updated flag exists so that when in the loop, the box only gets redrawn | |
when the size changes | |
* text flow inside the box updates after a new character is hit | |
* ``with curtsies.Input() as input:`` makes input be a generator, perhaps further | |
optimization could be done with calling next on it, instead of using it in a for loop | |
* the double break is to get out of the for loop, and then the ``while True:`` loop | |
* exceptions propagate out from the generator, hence the raise stop iteration error |
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
""" Test the speed of various string concatenation methods """ | |
import timeit | |
def not_join(size = (40,40)): | |
blank_dict = {} | |
output = '' | |
for y in range(size[1]): | |
if y>0: | |
output += '\n' | |
for x in range(size[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
from collections import UserDict | |
from numbers import Integral | |
class CellSpace(UserDict): | |
""" CellSpace adds 2D slicing and bounds information to dicts of (x,y) coordinate pairs. | |
Notes: CellSpace does not support assigning by slice at this point. | |
Height and width are not absolute measures of how many cells CellSpace contains in | |
either direction. Instead they show the max labeled cell, this can be considered |