Skip to content

Instantly share code, notes, and snippets.

View wouter-swierstra's full-sized avatar

Wouter Swierstra wouter-swierstra

View GitHub Profile
@wouter-swierstra
wouter-swierstra / notification.py
Last active June 18, 2019 12:35
Sending out email using UU mailservers
import smtplib, ssl, sys, csv, getpass, time
# Call this file passing a semi-colon separated csv file as argument, e.g.:
# > python notification.py marks.csv
# Set debug to False to really send out emails!
# Set debug to True prints draft emails to stdout
debug = False
fromAddress = 'w.s.swierstra@uu.nl'
username = 'w.s.swierstra@uu.nl'
subject = 'Resultaat voor Logica voor Informatica'
@wouter-swierstra
wouter-swierstra / Wat.hs
Created September 23, 2016 03:05
Haskell Symposium Lightning Talk
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
Prelude> 1 + 2
3
Prelude> minimum(100,1)
1
Prelude> minimum(1,100)
100
Prelude> let splat = splitAt 5 [0..10]
Prelude> splat
([0,1,2,3,4],[5,6,7,8,9,10])
@wouter-swierstra
wouter-swierstra / gist:b197dc81ff47481c4646
Last active August 29, 2015 14:13
Local information about CocoaHeads

Local information about CocoaHeads

The CocoaHeads NL meeting will be held at University of Utrecht on the campus, de Uithof. There are very regular busses to the Uithof from Utrecht CS (the main train station). For example, line 12 departing from Platform C3. Utrecht CS is currently undergoing some major renovation. You may want to take this into account when plannig your journey.

Dinner, drinks and reception will be from 18:00 to 19:00 in the Educatorium:

Click here for a picture

There is a large cantine on the ground floor of the Educatorium – you can't miss it. We will be in the Balkon Pi. Look for the hidden staircase in the corner of the cantine.

// Two structs
struct One{ }
struct Two{ }
// Overloading the foo function -
// it should always take two arguments, one of type One; the other of type Two
func foo(x:One,y:Two) {return }
func foo(x:Two,y:One) {return }
// In this example, Swift's type checker figures out that x must have type Two
@wouter-swierstra
wouter-swierstra / gist:0b6062c9660e751cd535
Created October 13, 2014 06:54
A type-level SAT solver in Swift
// A type-level SAT solver in Swift
// Two types to model Booleans
struct True { }
struct False { }
// Negation, Conjunction, Disjunction