Skip to content

Instantly share code, notes, and snippets.

View ChrisBeaumont's full-sized avatar

Chris Beaumont ChrisBeaumont

View GitHub Profile

Keybase proof

I hereby claim:

  • I am chrisbeaumont on github.
  • I am chrisbeaumont (https://keybase.io/chrisbeaumont) on keybase.
  • I have a public key ASDB4h57GMHDCGEVEyzsGBh1IDft6ve0ZDdxfnCyBhLkhwo

To claim this, I am signing this object:

@ChrisBeaumont
ChrisBeaumont / wheel.py
Created February 17, 2016 01:35
wheel of infinite fortune
import os
import pickle
from collections import defaultdict
from random import choice
import requests
from soupy import Soupy, Q
ROM = open('wheel.nes', 'rb').read()
CLUESET_PATH = 'clues.pickle'
# add to /opt/retropie/configs/nes/emulators.cfg
wheel="python3.4 /home/pi/wheel.py && /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-fceumm/fceumm_libretro.so --config /opt/retropie/configs/nes/retroarch.cfg /home/pi/RetroPie/roms/nes/Wheel2.nes"
hexdump -C wheel.nes | less
...
00014220 52 53 41 d2 d9 54 4f 54 41 cc 45 43 4c 49 50 53 |RSA..TOTA.ECLIPS|
00014230 45 20 4f c6 54 48 45 20 53 d5 ce 46 49 52 53 54 |E O.THE S..FIRST|
00014240 20 44 41 d4 c5 53 54 41 54 45 20 4f c6 54 48 45 | DA..STATE O.THE|
00014250 20 55 4e 49 4f ce 41 44 44 52 45 d3 d3 4d 4f 56 | UNIO.ADDRE..MOV|
import requests
from soupy import Soupy, Q
URL = "https://sites.google.com/site/wheeloffortunepuzzlecompendium/home/compendium/season-%i-compendium"
def scrape():
for i in range(1, 31):
dom = Soupy(requests.get(URL % i).text, 'html5')
def encode(clue):
"""Encode a plaintext clue into wheelscii."""
result = []
for c in clue:
if c == '\n':
result[-1] |= 0x80
else:
result.append(ord(c))
result[-1] |= 0x80
result[-2] |= 0x80
def parse_clues(data):
"""
Traverse a block of wheelscii-encoded puzzles,
yielding each decoded puzzle in ascii
"""
word = []
for pos, char in enumerate(data):
# check for signal character
if char & 0x80:
@ChrisBeaumont
ChrisBeaumont / wheel.py
Created January 26, 2016 05:51
Wheel of fortune puzzle decoding
from random import choice
from collections import defaultdict
import os
import pickle
import requests
from soupy import Soupy, Q
ROM = open('wheel.nes', 'rb').read()
CLUESET_PATH = 'clues.pickle'
<testsuite errors="0" failures="0" name="pytest" skips="0" tests="60" time="13.315">
<testcase classname="snpeff_annotator.tests.test_annotation.TestAnnotator" name="test_parse_annotate" time="13.1365170479">
<system-out><![CDATA[Annotating 1 alleles
]]></system-out>
</testcase>
<testcase classname="snpeff_annotator.tests.test_annotation.TestAnnotator" name="test_parse_vcf" time="0.000435829162598"/>
<testcase classname="dbnsfp_annotator.tests.test_annotation.TestAnnotator" name="test_get_one_absent" time="0.017"/>
<testcase classname="dbnsfp_annotator.tests.test_annotation.TestAnnotator" name="test_get_one_present" time="0.017"/>
<testcase classname="counsyl_curation_annotator.tests.test_annotation.TestCounsylCurationAnnotator" name="test_annotate_all" time="0.000">
<skipped message="Broken" type="unittest.case.SkipTest"><![CDATA[SkipTest: Broken
import sys
import warnings
class DeprecatedAttribute(object):
def __init__(self, name, value):
self.name = name
self.value = value