Skip to content

Instantly share code, notes, and snippets.

View steshaw's full-sized avatar
👨‍💻
Loves programming languages

Steven Shaw steshaw

👨‍💻
Loves programming languages
View GitHub Profile
@edwinb
edwinb / nestedrec.idr
Last active August 29, 2015 14:00
Nested record update syntax
record Person : Nat -> Type where
MkPerson : (name : String) ->
(age : Nat) ->
Person age
record Event : Type where
MkEvent : (name : String) -> (organiser : Person a) -> Event
record Meeting : Int -> Type where
MkMeeting : (event : Event) ->
@skilpat
skilpat / Client.v
Last active August 29, 2015 14:00
An example of a challenge for modularity in the context of dependent types: how to do useful stuff with only an *interface* of external components. Credit for this example goes to Neel Krishnaswami.
(* Here is some client code that needs to
construct a proof about fac. Because it doesn't
rely on any particular *representation* of
nats, it imports the abstract nat interface;
thus it could be linked against Peano, binary,
and other implementations of the nat interface. *)
(* Assume 'Nat' refers to the abstract spec, NatSpec. *)
Import Nat
// Quasiquoted excerpt
def cdef = q"""
class $ClassName[..$classTypeParams](..$primaryParams) extends ..$classParents {
..$primaryAccessors
def get = this
def isEmpty = ${quasi.isEmpty}
def copy(..$primaryWithDefaults) = $ObjectName(..$primaryNames)
module Printf
%default total
data Format = FInt Format -- %d
| FString Format -- %s
| FOther Char Format -- [a-zA-Z0-9]
| FEnd --
format : List Char -> Format
@Arkham
Arkham / remote.md
Last active November 25, 2023 09:34
Remote, office not required

Remote, Office Not Required

The Time is Right for Remote Work

Why work doesn't happen at work

The office during the day has become the last place people want to be when then really want to get work done.

Offices have become interruption factories: it's just one interruption after

@mankyKitty
mankyKitty / gist:10569173
Last active August 29, 2015 13:59
Trying to grok Functor for (a -> m b) type....thingy
-- Working through the Yorgey lectures on Applicatives for Haskell and trying to work out the homework...
-- A parser for a value of type a is a function which takes a String
-- represnting the input to be parsed, and succeeds or fails; if it
-- succeeds, it returns the parsed value along with the remainder of
-- the input.
newtype Parser a = Parser { runParser :: String -> Maybe (a, String) }
-- For example, 'satisfy' takes a predicate on Char, and constructs a
-- parser which succeeds only if it sees a Char that satisfies the
@dysinger
dysinger / gist:8760823
Created February 1, 2014 23:40
Idris -> Java Hello World in 6 lines
$ cabal sandbox init
$ cabal install idris
$ echo 'main : IO () ; main = print "hello"' >hello.idr
$ ./.cabal-sandbox/bin/idris --mvn --codegen Java -o hello hello.idr
$ cd hello
$ mvn -DmainClass=hello package shade:shade
$ java -jar target/hello.jar
"hello"
@bitemyapp
bitemyapp / gist:8739525
Last active May 7, 2021 23:22
Learning Haskell
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 10, 2025 09:21
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results