Skip to content

Instantly share code, notes, and snippets.

View bennuttall's full-sized avatar

Ben Nuttall bennuttall

View GitHub Profile
@bennuttall
bennuttall / 68F63A85B6324876CB58D456F8764A937.json
Last active December 20, 2015 15:09
External resources referred to in the conversation between @ben_nuttall and @ag_dubs in @common_bar on 2013-08-03. Check-in: https://twitter.com/ben_nuttall/status/364109789522972672. For a full transcript of the conversation please apply to the NSA stating reference number #68F63A85B6324876CB58D456F8764A937.
{
"Royal Mint": "http://www.royalmint.com/",
"e-petition: Put Alan Turing on the next £10 note": "http://epetitions.direct.gov.uk/petitions/31659",
"Jane Austen to be face of the Bank of England £10 note": "http://www.bbc.co.uk/news/business-23424289",
"Beards of Manchester": "http://beardsofmanchester.com/",
"Common Bar - Too Much Vino": "http://inkygoodness.com/blog/news/billy-presents-too-much-vino-common-bar-manchester/",
"Common Bar - The Common World": "http://thecommonworld.org/",
"Transport vs. Transportation": "http://grammarist.com/usage/transport-transportation/",
"Ubuntu Guake Changelog": "http://changelogs.ubuntu.com/changelogs/pool/universe/g/guake/guake_0.4.4-1ubuntu1/changelog",
"BBC Science Club": "http://www.bbc.co.uk/programmes/b03889v9",
@bennuttall
bennuttall / boat.m
Created September 9, 2013 01:53
MATLAB and Java Assignments
for j = 0:120
...
if rem(j,2) == 0
yboat = yboat + 1
else
yboat = yboat - 1
end
...
end
@bennuttall
bennuttall / conway.py
Last active April 2, 2024 11:42
Conway's Game of Life in Python with PyGame - by Ben Nuttall & Amy Mather
from time import sleep
from random import randint
import pygame
pygame.init()
#Initialise the screen
xmax = 600 #Width of screen in pixels
ymax = 600 #Height of screen in pixels
screen = pygame.display.set_mode((xmax, ymax), 0, 24) #New 24-bit screen
@bennuttall
bennuttall / fixubuntu.sh
Created November 8, 2013 22:27
Fix Ubuntu
gsettings set com.canonical.Unity.Lenses remote-content-search none; if [ "`/usr/bin/lsb_release -rs`" \< '13.10' ]; then sudo apt-get remove -y unity-lens-shopping; else gsettings set com.canonical.Unity.Lenses disabled-scopes "['more_suggestions-amazon.scope', 'more_suggestions-u1ms.scope', 'more_suggestions-populartracks.scope', 'music-musicstore.scope', 'more_suggestions-ebay.scope', 'more_suggestions-ubuntushop.scope', 'more_suggestions-skimlinks.scope']"; fi; echo | sudo tee -a /etc/hosts; echo 127.0.0.1 productsearch.ubuntu.com | sudo tee -a /etc/hosts;
@bennuttall
bennuttall / tudor.py
Created November 16, 2013 01:09
tudor puzzle
from itertools import product
puzzle = [24, 0, 12, 32, 0, 44, 23, 15, 0, 25, 24, 0, 33, 22, 0, 34, 21, 0, 15, 33, 22, 31, 12, 14, 0, 32, 15, 0, 24, 43, 0, 23, 15, 33, 42, 54, 0, 24, 0, 23, 12, 51, 15, 0, 32, 12, 42, 42, 24, 15, 14, 0, 43, 24, 53, 0, 44, 24, 32, 15, 43]
nums = product([1,2,3,4,5], repeat=2)
lets = [chr(n) for n in range(65, 91)]
combs = zip(nums, lets)
@bennuttall
bennuttall / piosk.py
Created November 27, 2013 22:40
piosk - some code I found on my laptop written by robie ages ago :/
import dbus
import gobject
from dbus.mainloop.glib import DBusGMainLoop
def device_added_callback(device):
print 'Device %s was added' % (device)
def device_changed_callback(device):
print 'Device %s was changed' % (device)
@bennuttall
bennuttall / conway.py
Last active August 29, 2015 14:02
conway.py
#!/usr/bin/python
from itertools import product
from random import choice
from time import sleep
import mcpi.minecraft as minecraft
mc = minecraft.Minecraft.create()
PX, PY, PZ = mc.player.getPos()
@bennuttall
bennuttall / codeclub.py
Created June 12, 2014 12:32
Minecraft Pi Example
import mcpi.minecraft as minecraft
from time import sleep
mc = minecraft.Minecraft.create()
mc.postToChat("Welcome to Minecraft Pi")
x, y, z = mc.player.getPos()
sleep(1)
@bennuttall
bennuttall / energenie.py
Last active August 29, 2015 14:04
rpio gpio example
from energenie import switch_on, switch_off
from time import sleep
# turn a plug socket on and off by number
switch_on(1)
switch_off(1)
# turn a plug socket on, then turn off after 10 seconds
switch_on(4)
sleep(10)
@bennuttall
bennuttall / tweepy.py
Created September 16, 2014 18:04
tweepy
import tweepy
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)