Skip to content

Instantly share code, notes, and snippets.

msgodf /
Last active Sep 28, 2018
Strange Loop 2018
msgodf /
Last active Sep 27, 2018
PWLConf 2018 notes

Computer-aided Concurrent Programming - Roopsha Samanta

Clarke and Emerson - Design and Synthesis of Sychnronization Skeletons using Branching-Time Temporal logic - Workshop on Logics of Programs (1981)

Processes are Finite-state synchronization skeletons - supress details about synchronization Communication model: Shared memory, interleaving based - one thread takes a step at a time Specification: Temporal logic Synchronization: Guarded commands

msgodf / Main.hs
Last active Sep 29, 2017
Example of Eta code that gives `java.lang.VerifyError: Bad type on operand stack` error.
View Main.hs
{-# LANGUAGE FlexibleContexts #-}
module Main where
import Java
import Java.Do
main :: IO ()
main = putStrLn $
mconcat $
fmap (\x -> let _ = x :: JInteger in show x) $
msgodf / construct-based-on-fields.purs
Created Jan 11, 2017
An attempt to create a different instance of a type depending on the presence of a field in the foreign (JS) object
View construct-based-on-fields.purs
data Sh = Sh1 {name :: String} | Sh2 {name :: String, age :: Int}
instance shIsForeign :: IsForeign Sh where
read x = do
name <- readProp "name" x
case (readProp "age" x) of
Left _ -> pure $ Sh1 {name:name}
Right age -> pure $ Sh2 {name: name, age: age}
frug :: Foreign -> String
msgodf /
Last active Nov 10, 2020
Notes on Algorithms to Live By by Brian Christian and Tom Griffiths


  • Compile AmiTCP example with only -lsocket
  • Setup nginx on rpi to share files between Amiga and rpi


  • Try opening v3 of bsdsocket.library and see whether httpget still works.
  • Get a working version of curl on the Amiga.
  • Use AmiTCP specific functions, not just bsdsocket.library ones
msgodf / wag_protocol.clj
Created Apr 21, 2016
A brief example of protocols and records in Clojure
View wag_protocol.clj
;; A protocol with a single method
(defprotocol Waggable
(wag [x]))
;; A record that implements that protocol
(defrecord Dog [name]
(wag [x]
(prn (str (:name x)
" wagged their tail"))))
msgodf / ngram.clj
Created Apr 20, 2016
A rough solution to Richard's most common phrase problem.
View ngram.clj
(let [input (take 1000 (repeatedly #(rand-int 10)))
n 3]
(take 10
(reverse (sort-by second
(frequencies (mapcat #(partition n (drop % input))
(range n)))))))
View learning.ijs
NB. Turn on tree formatting of sentences:
(9!:3) 4
NB. ┌─┬─┬─┬─┐
NB. │1│2│3│4│
NB. └─┴─┴─┴─┘

Monday 7th March 2016

14 minutes 2.74km

First run in a couple of weeks, and that was a quick 8 minute/2km one to try out my new trainers. This one started to get good around 2km, so I carried on a bit longer. A bit too quick again, but pace felt good. Legs aching and a bit heavy, and feeling tight afterwards.