Skip to content

Instantly share code, notes, and snippets.

@Kiwi
Kiwi / demo.hs
Created February 28, 2020 23:20
arduino-copilot eeprom demo
{-# LANGUAGE RebindableSyntax #-}
import Copilot.Arduino.Uno
import qualified Copilot.Arduino.Library.EEPROMex as EEPROM
import qualified Copilot.Arduino.Library.Serial as Serial
import System.Posix.Env
import qualified Prelude
main :: IO ()
main = do
@Kiwi
Kiwi / conf.nix
Created February 6, 2020 16:43 — forked from sorki/conf.nix
overlays prototype
hardware.deviceTree.overlays = [
{ name = "spi"; dtsFile = "${./dt/spi.dts}"; }
{ name = "pps";
dtsText = ''
/dts-v1/;
/plugin/;
/ {
compatible = "raspberrypi";
fragment@0 {
@Kiwi
Kiwi / Cosort.hs
Created April 29, 2019 17:26
Contravariant version of Divide and Conquer algorithm
#! /usr/bin/env cabal
{- cabal:
build-depends:
, base ^>= 4.12
, contravariant ^>= 1.5
-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
@Kiwi
Kiwi / c.hs
Created April 17, 2019 06:12 — forked from tonymorris/c.hs
cancelUnit ::
Iso (a, ()) (b, ()) a b
cancelUnit =
iso
(\(a, ()) -> a)
(\b -> (b, ()))
cancelVoid ::
Iso (Either a Void) (Either b Void) a b
#!/usr/bin/python2.4
#
# Copyright 2007 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#