Skip to content

Instantly share code, notes, and snippets.

Nicholas Tollervey ntoll

Block or report user

Report or block ntoll

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:0d7f42fd7d45a39eec1f4976beed9ca1
[WARNING] [ffpyplayer ] SDL_OpenAudio (2 channels, 44100 Hz): No such audio device
[WARNING] [ffpyplayer ] SDL_OpenAudio (1 channels, 44100 Hz): No such audio device
[ERROR ] [ffpyplayer ] No more channel combinations to try, audio open failed
[CRITICAL] [ffpyplayer ] Failed to open file '/home/ntoll/src/pyoa/meow1.wav' or configure filtergraph
View Python2.7 Pygame tests
$ python -m pygame.tests
pygame 1.9.4.dev0
Hello from the pygame community. https://www.pygame.org/contribute.html
skipping pygame.tests.cdrom_test (tag 'interactive')
skipping pygame.tests.midi_test (tag 'interactive')
skipping pygame.tests.scrap_test (tag 'subprocess_ignore')
loading pygame.tests.base_test
loading pygame.tests.blit_test
loading pygame.tests.bufferproxy_test
loading pygame.tests.camera_test
View Python3.7 output
$ python -m pygame.tests
pygame 1.9.4.dev0
Hello from the pygame community. https://www.pygame.org/contribute.html
skipping pygame.tests.cdrom_test (tag 'interactive')
skipping pygame.tests.midi_test (tag 'interactive')
skipping pygame.tests.scrap_test (tag 'subprocess_ignore')
skipping pygame.tests.sndarray_test (tag 'subprocess_ignore')
skipping pygame.tests.surfarray_test (tag 'subprocess_ignore')
loading pygame.tests.base_test
loading pygame.tests.blit_test
@ntoll
ntoll / light_sensor.py
Created Jun 25, 2018
Code for reading the light-sensor readings from a Circuit Playground Express board by Adafruit.
View light_sensor.py
import time
import analogio
import board
light = analogio.AnalogIn(board.LIGHT)
while True:
print((light.value,))
time.sleep(0.1)
View gist:fee452452dc3472486e804e52ac26cea
CSV
====
import csv
with open('swapi.csv') as f:
reader = csv.reader(f)
items = list(reader)
@ntoll
ntoll / main.py
Created Apr 10, 2018
Attack of the Killer-Cave Plotter from the Planet Raxxla!
View main.py
"""
Attack of the Killer-Cave Plotter from the Planet Raxxla!
by Nicholas H.Tollervey. Released into the public domain.
Instructions:
Open Mu, put it into Adafruit mode and switch on the REPL
and plotter.
@ntoll
ntoll / crapamagotchi.py
Created Aug 8, 2017
A really crap Tamagotchi for micro:bit
View crapamagotchi.py
# Make the display sparkle. Click button A to show an image for
# a moment before the sparkles start again. Click button B to
# scroll a friendly message before the sparkles return.
# By Nicholas H.Tollervey and released to the Public Domain.
# How would you improve this code?
from microbit import *
import random
# A full list of images can be found here: http://bit.ly/1WY221q
images = [Image.HAPPY, Image.SAD, Image.GHOST, Image.SKULL,
View test.py
import time
print('start')
for i in range(10):
print(i)
time.sleep(1)
print('stop')
View gist:bdccfb45e320f3a88194d825f2f95630
from microbit import *
radio.on()
while True:
if radio.receive():
display.show(image.DUCK)
if accelerometer.was_gesture('shake'):
radio.send('duck')
sleep(20)
@ntoll
ntoll / daisy.py
Created Apr 11, 2017
MicroPython code for singing "Daisy, Daisy" on a micro:Bit
View daisy.py
# Add your Python code here. E.g.
import speech
line1 = [
'#26DEYYYYYYYYY',
'#31ZIYIYIYIYIYIYIY',
'#39DEYYYYYYYYY',
'#52ZIYIYIYIYIYIYIY',
'#46GIXV',
'#42MIYIY',
You can’t perform that action at this time.