Skip to content

Instantly share code, notes, and snippets.

View ntoll's full-sized avatar
🎵
This statement is false...

Nicholas Tollervey ntoll

🎵
This statement is false...
View GitHub Profile
$ cd foox
$ mkvirtualenv foox
New python executable in foox/bin/python
Installing setuptools, pip...done.
$ python setup.py install
running install
running build
running build_py
[... a bunch of install stuff ...]
$ foox -s 1 -cf 5 7 6 5 8 7 9 8 7 6 5
>>> class Foo:
... def __init__(self):
... super()
...
>>> x = Foo()
>>>
Verifying that +ntoll is my openname (Bitcoin username). https://onename.com/ntoll
while True:
scroll_string_image(StringImage('HELLO TRANSCODE!'),100)
import java.io.IOException;
import com.fluidinfo.*;
import com.fluidinfo.fom.*;
import com.fluidinfo.fom.Object;
import org.json.*;
public class fluidTest {
/**
* Some example code for using the Fluid Object Model (FOM) classes with
@ntoll
ntoll / Boingboing.py
Created April 18, 2011 13:49
A slight modification for Jareth - automatically gets the RSS feed. See inline comments... ;-)
import feedparser
import httplib2 # This library allows you to make HTTP requests
# Defines the URL of the RSS feed for BoingBoing.net
RSS_FEED = "http://feeds.boingboing.net/boingboing/iBag"
# Create a new Http object and use it to make a request to get the feed
http = httplib2.Http()
# headers contains the result headers, boingboing_rss contains the feed itself
headers, boingboing_rss = http.request(RSS_FEED)
@ntoll
ntoll / gist:1012469
Created June 7, 2011 15:24
Dynamic creation of tags for a FOM class
# Untested and the result of a brain dump
from fom.mapping import Object, tag_value
# the list of users I'm interested in
users = ['ntoll', 'gridaphobe', 'terrycojones', 'jkakar', ]
# they all should have a username/foo/bar tag
path_template = '%s/foo/bar'
# the dict will have the key (for attribute name) and tag_value (for the tag)
# Play a game of squeeky pong with a 1m (30 led) NeoPixel strip. :-)
from microbit import *
import music
import neopixel
np = neopixel.NeoPixel(pin1, 30)
def show_pixel(position, wait):
@ntoll
ntoll / acuity.py
Created February 15, 2016 10:10
A brightness acuity game. See copious comments in-line. Runs on the BBC micro:bit.
# Light acuity game. A pixel will change on either the
# left or the right. Click the appropriate button within
# an ever decreasing amount of time to increase your score.
# The game is over when you get it wrong or don't answer
# in time.
# Based on an idea by Dave Gibbs.
# By Nicholas Tollervey, Feb. 2016. Released to the public domain.
from microbit import *
import random
from micropython import *
import random
dots = [ [0]*5, [0]*5, [0]*5, [0]*5, [0]*5 ]
while True:
dots[random.randrange(5)][random.randrange(5)] = 9
for i in range(5):
for j in range(5):
display.set_pixel(i, j, dots[i][j])
dots[i][j] = max(dots[i][j] - 1, 0)