Skip to content

Instantly share code, notes, and snippets.

View neanias's full-sized avatar

William Mathewson neanias

View GitHub Profile

A basic exercise to help learn the basics of Python

A change dispenser

Write a programme for an automatic change dispenser. It will choose the correct coins to dispense based on the amount required. It should work like this:

  1. Prompt the user for a number between 0 & 99 (this represents the change due.)
  2. Output the correct number of 50p, 20p, 10p, 5p, 2p or 1p coins to dispense.
#!/usr/bin/env python
# Python 2 and 3 compatible.
# Python program to take a pdf file, and split it into color and black
# and white part(s). Requires pdftk and one of gs and pdftoppm.
#
# Iain Murray, February 2010.
#
# Inspired by dvicoloursplit.py, Jeremy Sanders 2001, although written
# from scratch.
@neanias
neanias / BucketballRules.md
Created February 28, 2018 10:18
Rules for the RN game of bucketball

Bucketball Rules

Pitch

The pitch is usually an indoor hall. At either end of the pitch, there is a bench, but can be a gym mat depending on available equipment, upon which the bucket holder stands. There should be a small 'no-entry' zone in front of the bench that no attacker nor defender may enter. This may be signified using another mat or features of the pitch, such as a marked 'D'.

Teams

@neanias
neanias / longest_string.py
Last active February 1, 2018 00:32
MIT Problem
string = "abcadefzab"
longest_string = ''
current_string = ''
last_char = ''
for char in string:
if char >= last_char:
current_string += char
elif last_char > char:
running=$(pidof spotify)
if [ "$running" != "" ]; then
artist=$(playerctl metadata artist)
song=$(playerctl metadata title | cut -c 1-60)
echo -n "$artist · $song"
fi
@neanias
neanias / GoldenSyrupSponge.md
Last active April 4, 2017 16:26
Recipes for Golden Syrup Sponge in a slow cooker
  1. Grease a bowl
  2. Make a sponge (See attached sponge mixture recipe)
  3. Pour a bunch of golden syrup into the bowl (A lot of Golden Syrup is encouraged, ask your dentist how much Golden syrup is too much and at least double it)
  4. Put the sponge mix on top
  5. Pop it in the slow cooker on high with a bit of water in the bottom
  6. Wait til it's cooked (Maybe 2 hours? "It was a long time" - Dhileas)

Keybase proof

I hereby claim:

  • I am neanias on github.
  • I am neanias (https://keybase.io/neanias) on keybase.
  • I have a public key whose fingerprint is B654 B282 9032 4EEC 91DD 2320 1BFF 097B 7744 F6C2

To claim this, I am signing this object:

echo '2017-03-10 14:08 <tbrb> ok i need to look at how to sed' | perl -pe 's/\d{4}-\d{2}-\d{2} \d{2}:\d{2} <\w+> //g'
#=> ok i need to look at how to sed
# I don't think the syntax highlighter likes this
Uri.regexp == /
([a-zA-Z][\-+.a-zA-Z\d]*): (?# 1: scheme)
(?:
((?:[\-_.!~*'()a-zA-Z\d;?:@&=+$,]|%[a-fA-F\d]{2})(?:[\-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]]|%[a-fA-F\d]{2})*) (?# 2: opaque)
|
(?:(?:
\/\/(?:
(?:(?:((?:[\-_.!~*'()a-zA-Z\d;:&=+$,]|%[a-fA-F\d]{2})*)@)? (?# 3: userinfo)
(?:((?:(?:[a-zA-Z0-9\-.]|%\h\h)+|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[(?:(?:[a-fA-F\d]{1,4}:)*(?:[a-fA-F\d]{1,4}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(?:(?:[a-fA-F\d]{1,4}:)*[a-fA-F\d]{1,4})?::(?:(?:[a-fA-F\d]{1,4}:)*(?:[a-fA-F\d]{1,4}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))?)\]))(?::(\d*))?))? (?# 4: host, 5: port)
@neanias
neanias / table.md
Last active February 9, 2017 12:13
Boys Girls
Will - P Dhileas - P
Jack - P Riva - P
Brendan - P Shannon - P
John - P Ning - P
Tim - P Michelle - P
Arthur - P Clare - P
Ned - P Andreea - P