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 pathlib import Path | |
from structlog import get_logger | |
from PIL import Image | |
logger = get_logger() | |
dir = Path.cwd() |
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 json | |
import argparse | |
with open("words.json") as f: | |
WORDS = json.load(f) | |
def starts_with(chars): | |
return { | |
word | |
for word 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 string import ascii_lowercase | |
import argparse | |
import random | |
LINUX_SYSTEM_DICT = '/usr/share/dict/american-english' | |
MAC_SYSTEM_DICT = '/usr/share/dict/words' | |
BIG_WORDLIST = 'words.txt' | |
# wordlist = LINUX_SYSTEM_DICT | |
wordlist = MAC_SYSTEM_DICT |
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
CIGAR | |
REBUT | |
SISSY | |
HUMPH | |
AWAKE | |
BLUSH | |
FOCAL | |
EVADE | |
NAVAL | |
SERVE |
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 pathlib import Path | |
from piwheels.slave.builder import Builder, Wheel | |
wheel_file_path = Path("awkward-1.0.0-cp37-cp37m-linux_armv7l.whl") | |
builder = Builder(None, None) | |
wheel = Wheel(wheel_file_path) | |
builder.build_dependencies(wheel) |
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 itertools import product | |
def count_neighbours(x, y): | |
deltas = set(product((-1, 0, 1), repeat=2)) - {(0, 0)} | |
return len({(x + dx, y + dy) for (dx, dy) in deltas} & lights_on) | |
def evolve(lights_on): | |
still_on = {(x, y) for x, y in lights_on if count_neighbours(x, y) in (2, 3)} | |
now_off = set(product(range(SIZE), repeat=2)) - lights_on | |
turn_on = {(x, y) for x, y in now_off if count_neighbours(x, y) == 3} |
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 pathlib import Path | |
from collections import defaultdict | |
missing_wheels = defaultdict(set) | |
extra_wheels = defaultdict(set) | |
rewrites = set() | |
total_missing = 0 | |
total_extra = 0 | |
with open('missing.txt') as f: |
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 mosromgr.mostypes import MosFile | |
from glob import glob | |
from git import Repo | |
files = glob('*.mos.xml') | |
ro, *mosfiles = sorted(MosFile.from_file(f) for f in files) | |
repo = Repo.init('.') | |
ro_id = ro.ro_id.replace(';', '_') |
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
for f in */*LOG*.csv; do | |
tr < $f -d '\000' > $f.tmp | |
mv $f.tmp $f | |
done |
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^wp-content/uploads/(.*)$ https://bennuttall.com/wp-content/uploads/$1 [L,R=302] | |
</IfModule> |
NewerOlder