Skip to content

Instantly share code, notes, and snippets.

View dorchard's full-sized avatar

Dominic Orchard dorchard

View GitHub Profile
@dorchard
dorchard / OrdersAndEquivClasses.agda
Last active January 30, 2020 09:24
The quotient set of a preorder is a partial order (proof - wip)
module OrdersAndEquivClasses where
open import Level
open import Data.Product
-- X is the base
-- S is a set of things drawn from X
record PreOrder {l l' : Level} {X : Set l} {S : X -> Set l'} : Set (Level.suc l ⊔ l') where
field
_<_ : Σ X S -> Σ X S -> Set l
@dorchard
dorchard / newpaper
Created September 7, 2019 14:50
newpaper - A script that generate a fresh paper stub
#!/bin/bash
cp ~/template.tex paper.tex
@dorchard
dorchard / aide-memoire.tex
Created September 13, 2018 09:32
LaTeX for creating the 'aide-memoire' page at the back of my lecture notes. To help students with their learning.
\documentclass[a4paper]{article}
\usepackage[table,x11names]{xcolor}
\usepackage{afterpage}
\usepackage{colortbl}
\usepackage{forloop}
\usepackage{geometry}
\begin{document}
@dorchard
dorchard / ott-advice.md
Last active February 24, 2019 22:31
Dealing with Ott "! LaTeX Error: Too many math alphabets used in version normal."

Whilst using the Ott tool for defining programming languages and semantics (http://www.cl.cam.ac.uk/~pes20/ott/) I have noticed that I sometimes get the following error when compiling its generated LaTeX:

  ! LaTeX Error: Too many math alphabets used in version normal.

This is a difficult to track down error (but also mildly amusing)! Here are the solutions/reasons I've found so far:

  • Using pdflatex? Try switching to xelatex which can support up 256 math fonts.
@dorchard
dorchard / advice.md
Last active March 28, 2023 12:28
Some exam advice for students.

(by Dominic Orchard, School of Computing, University of Kent, 2018)

Disclaimer: this advice is non exhaustive, and every piece of advice might not suit you. At least, I hope it helps you to think about how you can develop your own strategy for exam preparation.

My top tip is to see exams as formative rather than purely about assessment. This is an opportunity to force yourself to learn a topic deeply, which will then benefit you in the future, rather than a box ticking exercise to get a fancy piece of paper at the end. This will orient your attitude to maximising your potential.

Exams are hard. They occupy a short space of time in your whole life but they can have a big impact on the rest of it, so make the most of them. Study well and study wisely.

Exam preparation

@dorchard
dorchard / gist:18837114c92a2dd0ab696dae497e85ce
Created March 7, 2018 15:30
Atom snippets for adding infinity alias in Granule
'.source.idris':
'∞':
'prefix': 'Inf'
'body': '∞'
'.source.haskell':
'∞':
'prefix': 'Inf'
'body': '∞'
@dorchard
dorchard / Makefile.template
Created February 14, 2018 10:19
A script that generates a simple makefile (with no dependency tracking) for latex / bibtex that I use all the time.
default: quick
quick:
pdflatex paper.tex
full:
pdflatex paper.tex
bibtex paper
pdflatex paper.tex
pdflatex paper.tex
@dorchard
dorchard / CBNLambdaEff.hs
Last active November 15, 2018 20:40
A Haskell implementation of the categorical semantics for the effectful CBN lambda calculus
{-# LANGUAGE GADTs, TypeFamilies, EmptyDataDecls #-}
{-
A Haskell-based implementation of the monadic semantics for the
simply-typed Call-By-Name computational lambda calculus, following
Moggi's 'Computational lambda-calculus and monads' (1989) (technical report version)
but for the typed calculus (rather than untyped as in this paper).
Category theory seminar, Programming Languages and Systems group,
@dorchard
dorchard / gist:2ef456b5c9bccd5bbe3c0c2c646d233a
Last active August 16, 2017 22:39
Auto highlighting with lhs2TeX
% Highlight comments in darkgreen
\definecolor{darkgreen}{rgb}{0,0.5,0}
\newcommand{\commenthighlight}{\color{darkgreen}\quad-{}- }
\let\onelinecomment=\commenthighlight
% Highlight constructors in darkblue
\definecolor{darkblue}{rgb}{0,0,0.5}
\renewcommand{\Conid}[1]{\textcolor{darkblue}{\textit{#1}}}
@dorchard
dorchard / Category.agda
Last active August 17, 2017 14:13
Definition of a category as an Agda record: level polymorphic in the objects and arrows
module Category where
open import Level
open import Relation.Binary.PropositionalEquality
open Level
record Category {lobj : Level} {larr : Level} : Set (suc (lobj ⊔ larr)) where
field obj : Set lobj
arr : (src : obj) -> (trg : obj) -> Set larr