Skip to content

Instantly share code, notes, and snippets.

View rec's full-sized avatar
πŸ₯
coding

Tom Ritchford rec

πŸ₯
coding
View GitHub Profile
@rec
rec / future-of-bibliopixel.md
Last active June 22, 2017 11:27
The Future of BiblioPixel

After 3.0! A long-term roadmamp for BiblioPixel

Now that 3.0 is ready, it's time to look forward to the long-term - because without a long-term plan with something really exciting at the end, this is just a maintenance exercise.

BiblioPixel has three types of components: animations, layouts and drivers.

And our long-term goals are solving six problems:

  1. sharing: to reuse components and share them with others.
{
"driver": "simpixel",
"layout": "strip",
"animation": {
"typename": "BiblioPixelAnimations.strip.LarsonScanners.LarsonScanner",
"color": [255,0,0],
"tail": 1,
"start": 0,
"end": -1
{
"layout": "matrix",
"animation": "matrix_test",
"run": {
"threaded": true
}
}
@rec
rec / scroll.py
Last active August 28, 2017 10:14
scroll an animation
from bibliopixel.animation import BaseAnimation
from bibliopixel import colors
# This is using the default 32x32 simpixel display -
# so this is a list of 16 * 64 = 1024 colors.
BASE = [
colors.Black, colors.Black, colors.Black, colors.Black,
colors.Green, colors.Green, colors.Green, colors.Green,
colors.Blue, colors.Blue, colors.Blue, colors.Blue,
colors.White, colors.White, colors.White, colors.White,
shape: 50
animation:
typename: mixer
levels: [1, 0, 0]
animations: [$bpa.strip.Wave, $bpa.strip.HalvesRainbow, $bpa.strip.PartyMode]
controls:
typename: midi
extractor:
def synonym_queries(synonym_words, queries):
'''
synonym_words: iterable of pairs of strings representing synonymous words
queries: iterable of pairs of strings representing queries to be tested for
synonymous-ness
'''
synonyms = defaultdict(set)
for w1, w2 in synonym_words:
synonyms[w1].add(w2)
f(factorial)(10)
@rec
rec / Better dispatch
Last active September 4, 2019 12:56
dispatch.py
class Dispatch:
def monday(self): pass # Implementations here...
def tuesday(self): pass
def wednesday(self): pass
def thursday(self): pass
def friday(self): pass
def saturday(self): pass
def sunday(self): pass
class Mutable:
pass
foo, bar = Mutable(), Mutable()
foo.x = 1 # It's mutable!
d = {foo: 'foo', bar: 'bar'}
print(d[foo])
$ pip install -r pip-req.txt
Collecting nose>=1.3.0
Using cached https://files.pythonhosted.org/packages/15/d8/dd071918c040f50fa1cf80da16423af51ff8ce4a0f2399b7bf8de45ac3d9/nose-1.3.7-py3-none-any.whl
Collecting tox>=1.6.1
Downloading https://files.pythonhosted.org/packages/77/a7/a5b721d9bf955edfe36013e5ecc9136fc6b2fef622ab1797ff0560273d8e/tox-3.14.3-py2.py3-none-any.whl (80kB)
|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 81kB 1.7MB/s
Processing /Users/tom/Library/Caches/pip/wheels/b0/eb/ac/80e48148e00b449d5f2b60478c31f1e0fb5ec45b04950e800f/coverage-5.0.3-cp38-cp38-macosx_10_9_x86_64.whl
Collecting pylint>=1.1.0
Downloading https://files.pythonhosted.org/packages/e9/59/43fc36c5ee316bb9aeb7cf5329cdbdca89e5749c34d5602753827c0aa2dc/pylint-2.4.4-py3-none-any.whl (302kB)
|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 307kB 5.1MB/s