This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
trap "trap - SIGTERM && echo 'shutting down!' && kill -- -$$" SIGINT SIGTERM EXIT | |
echo "kill me with 'kill $$'" | |
(nohup raspivid -o - -t 0 -w 800 -h 600 -fps 15 2>/dev/null | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8080/}' :demux=h264 --h264-fps=15 >/dev/null 2>&1) & | |
PID=$! | |
wait $PID | |
trap - SIGINT SIGTERM EXIT | |
wait $PID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> {}; derivation { name = "fake"; builder = "${coreutils}/bin/touch"; args=[(placeholder "out")]; system = builtins.currentSystem; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- requires to >= from -} | |
let stepsFromTo: Natural -> Natural -> Natural -> Natural = | |
\(from: Natural) -> | |
\(to: Natural) -> | |
\(step: Natural) -> | |
let diff = Natural/subtract from to | |
let State = { i: Natural, val: Natural } | |
let state = { i = 0, val = from } | |
let foldState = \(s: State) -> if Natural/isZero (Natural/subtract s.val to) | |
then s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DeriveFunctor #-} | |
module Circ ( | |
Circ | |
, empty | |
, singleton | |
, length | |
, null | |
, delete | |
, rotateR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect | |
import shapely | |
class DataDumper: | |
def __init__(self, path): | |
self._handle = open(path, 'w') | |
def __enter__(self): | |
return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
divert(-1) | |
changequote(`{', `}') | |
# gensym counter | |
define({%n}, 0) | |
# association for generic bodies | |
# _generic_setbody(name, body) -> store generic body by name | |
define({_generic_setbody}, {define({%gen[$1]}, $2)}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
# our goal is to standardize exactly 2 out of 4 columns in a grouped frame, | |
# using the within-group standard deviation and mean | |
df = pd.DataFrame({ | |
'a': ['Bennie', 'Bennie', 'Bennie', 'The Jets', 'The Jets'], | |
'b': [1.0, 3.0, 2.5, 7.1, 8.9], | |
'c': [-71.3, -80.4, -68.1, 2.5, 3.4], | |
'd': [25, 30, 40, 10, 15] # don't standardize me! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# there is probably a way to get this from "stack path" | |
INCLUDE=C:\Users\Derrick\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.4\lib\include | |
all: hsdll.dll hsdll_stub.h usehsdll.exe | |
%.dll %_stub.h: %.hs %.def | |
stack ghc -- $^ --make -O2 -shared -static -o $@ | |
%.exe: %.c hsdll_stub.h hsdll.dll | |
gcc -O2 -I$(INCLUDE) -Wall -Wextra -std=c11 -pedantic $^ hsdll.dll -o $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://docs.dhall-lang.org/howtos/How-to-translate-recursive-code-to-Dhall.html | |
let Person : Type | |
= ∀(Person : Type) | |
→ ∀(MakePerson : { children : List Person, name : Text } → Person) | |
→ Person | |
let example : Person | |
= λ(Person : Type) → | |
λ(MakePerson : { children : List Person, name : Text } → Person) → |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- see https://www.haskellforall.com/2021/01/the-visitor-pattern-is-essentially-same.html | |
{-# LANGUAGE RankNTypes #-} | |
-- with ADTs: | |
data Shape | |
= Circle Double Double Double | |
| Rectangle Double Double Double Double | |
deriving (Eq, Show) |