Skip to content

Instantly share code, notes, and snippets.

View AngusP's full-sized avatar

Angus Pearson AngusP

  • London
View GitHub Profile
@AngusP
AngusP / tardis.ed.ac.uk
Created November 2, 2013 00:26
Got seriously bored, so yeah:
_______ _______ ______ ______ _____ _______
| |_____| |_____/ | \ | |_____
| | | | \_ |_____/ __|__ ______|
___
[ @ ]
__________[_@_]__________
| POLICE BOX |
|_________________________|
| ,_____, | |
| |_|_|_| |[####@####]|
@AngusP
AngusP / longestProductLen
Created November 6, 2013 16:27
Answer to q1 tut6
longestProductLen :: [(Barcode, Item)] -> Int
longestProductLen xs = hold xs 0
where
hold [] l = l
hold ((b,(name,i)):xs) longest
| length name > longest = hold xs (length name)
| otherwise = hold xs longest
@AngusP
AngusP / INF1 FP Exam Dec 2013
Last active December 31, 2015 23:19
Reverse Polish Notation
-- This is from the Morning Exam
rpn :: Expr -> [String]
rpn X = ["X"]
rpn (Const n) = [show n]
rpn (a :+: b) = (rpn a) ++ (rpn b) ++ ["+"]
rpn (a :*: b) = (rpn a) ++ (rpn b) ++ ["*"]
rpn (Neg a) = (rpn a) ++ ["-"]
-- NB: I can't really remember how negation was
-- represented, this might not be it...
@AngusP
AngusP / compsoc.avr.hex
Created February 13, 2014 13:38
Python is a tad too high level... Down with the abstraction!
:100000000C9435000C945D000C945D000C945D0024
:100010000C945D000C945D000C945D000C945D00EC
:100020000C945D000C945D000C945D000C945D00DC
:100030000C945D000C945D000C945D000C945D00CC
:100040000C9476000C945D000C945D000C945D00A3
:100050000C945D000C945D000C945D000C945D00AC
:100060000C945D000C945D005F0011241FBECFEF67
:10007000D8E0DEBFCDBF11E0A0E0B1E0E2EDF2E0FC
:1000800002C005900D92A030B107D9F711E0A0E0B1
:10009000B1E001C01D92AA30B107E1F710E0CAE655
@AngusP
AngusP / gist:9213247
Created February 25, 2014 17:06
Emacronyms
EMACS probably stands for one of the following:
Escape Meta Alt Control Shift
Eight Megabytes And Constantly Swapping
Eventually Munches All Computer Storage
Easily Mangles, Aborts, Crashes and Stupifies
Even a Master of Arts Comes Simpler
Emacs Manuals Are Cryptic and Surreal
Emacs May Annihilate Command Structures
Energetic Merchants Always Cultivate Sales
rfcToEntry :: String -> String -> Maybe Entry
rfcToEntry t str
| " PRIVMSG" `isPrefixOf` (dropWhile (/=' ') str) && ":ACTION" `isPrefixOf` (dropWhile (/=':') $ dropWhile (/=' ') str)
= Just ( t , takeWhile (/='!') $ drop 1 str ,
(takeWhile (/='!') $ drop 1 str) ++ (dropWhile (/=' ') $ dropWhile (/=':') $ tail $ dropWhile (/=' ') $ tail str) )
| " PRIVMSG" `isPrefixOf` (dropWhile (/=' ') str) = Just ( t , takeWhile (/='!') $ drop 1 str ,
tail $ dropWhile (/=':') $ dropWhile (/=' ') $ tail str )
| " PART" `isPrefixOf` (dropWhile (/=' ') str) = Just ( t , takeWhile (/='!') $ drop 1 str , "$left" )
| " QUIT" `isPrefixOf` (dropWhile (/=' ') str) = Just ( t , takeWhile (/='!') $ drop 1 str , "$left" )
| " JOIN" `isPrefixOf` (dropWhile (/=' ') str) = Just ( t , takeWhile (/='!') $ drop 1 str , "$joined" )
@AngusP
AngusP / FishBush.hs
Last active August 29, 2015 14:18
Fiiiiish BUUUUUsssh
thingy :: Integer -> IO()
thingy num = fb num 1
where
fb :: Integer -> Integer -> IO()
fb stop n
| n > stop = putStrLn ""
| (mod n 3) == 0 && (mod n 5) == 0 = do
putStrLn "FISSSSSHBUSSSHH!"
fb stop (n+1)
| (mod n 3) == 0 = do
anguspearson@stygimo /tmp $ % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Unable to find image 'ev3:latest' locally
Trying to pull repository docker.io/library/ev3 ... curl: (6) Could not resolve host: ev3
fatal: unable to access 'https://ev3/ev3/': Could not resolve host: ev3
[sudo] password for anguspearson:
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:

Keybase proof

I hereby claim:

  • I am AngusP on github.
  • I am angusp (https://keybase.io/angusp) on keybase.
  • I have a public key whose fingerprint is 5B48 95B4 7066 AF9C ED56 D364 D6A5 EFE7 8E9C 40E3

To claim this, I am signing this object: