Skip to content

Instantly share code, notes, and snippets.

@msgodf
msgodf / sl2018.md
Last active Sep 28, 2018
Strange Loop 2018
View sl2018.md
@msgodf
msgodf / pwlconf2018.md
Last active Sep 27, 2018
PWLConf 2018 notes
View pwlconf2018.md

Computer-aided Concurrent Programming - Roopsha Samanta

https://pwlconf.org/2018/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
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
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
msgodf / algorithms-to-live-by.md
Last active Nov 10, 2020
Notes on Algorithms to Live By by Brian Christian and Tom Griffiths
View algorithms-to-live-by.md
View amiga-todo.md

Done

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

Todo

  • 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
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]
Waggable
(wag [x]
(prn (str (:name x)
" wagged their tail"))))
@msgodf
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
1;2;3;4
NB. ┌─┬─┬─┬─┐
NB. │1│2│3│4│
NB. └─┴─┴─┴─┘
View runs.md

Monday 7th March 2016

14 minutes 2.74km http://www.gmap-pedometer.com/?r=6814407

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.