Skip to content

Instantly share code, notes, and snippets.

Avatar

Angus Pearson AngusP

View GitHub Profile
@AngusP
AngusP / keybase.md
Created Mar 28, 2016
Keybase Prove GitHub
View keybase.md

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 FA24 28ED D3CE F60F 311B 22C7 6DB6 C5D5 AB4C 6B69

To claim this, I am signing this object:

View XKCD install
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:
@AngusP
AngusP / FishBush.hs
Last active Aug 29, 2015
Fiiiiish BUUUUUsssh
View FishBush.hs
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
View horrible-haskell-of-the-day
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" )
View gist:9213247
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
@AngusP
AngusP / compsoc.avr.hex
Created Feb 13, 2014
Python is a tad too high level... Down with the abstraction!
View compsoc.avr.hex
:100000000C9435000C945D000C945D000C945D0024
:100010000C945D000C945D000C945D000C945D00EC
:100020000C945D000C945D000C945D000C945D00DC
:100030000C945D000C945D000C945D000C945D00CC
:100040000C9476000C945D000C945D000C945D00A3
:100050000C945D000C945D000C945D000C945D00AC
:100060000C945D000C945D005F0011241FBECFEF67
:10007000D8E0DEBFCDBF11E0A0E0B1E0E2EDF2E0FC
:1000800002C005900D92A030B107D9F711E0A0E0B1
:10009000B1E001C01D92AA30B107E1F710E0CAE655
@AngusP
AngusP / INF1 FP Exam Dec 2013
Last active Dec 31, 2015
Reverse Polish Notation
View INF1 FP Exam Dec 2013
-- 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...
View longestProductLen
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 / tardis.ed.ac.uk
Created Nov 2, 2013
Got seriously bored, so yeah:
View tardis.ed.ac.uk
_______ _______ ______ ______ _____ _______
| |_____| |_____/ | \ | |_____
| | | | \_ |_____/ __|__ ______|
___
[ @ ]
__________[_@_]__________
| POLICE BOX |
|_________________________|
| ,_____, | |
| |_|_|_| |[####@####]|