Skip to content

Instantly share code, notes, and snippets.

@dustin
dustin / aoc.hsfiles
Last active December 1, 2021 02:16
Template for AoC
{-# START_FILE stack.yaml #-}
resolver: lts-18.18
packages:
- '.'
extra-deps:
- astar-0.3.0.0@sha256:8bf6350542e9db9451490e8993560ee843dc48a61d46a206985430f9b62461c8,967
- git: https://github.com/dustin/aoc.git
commit: 60b4a01f9c09863d16833bcd766daf8855281d26
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RecordWildCards #-}
module Main where
import Data.List (intercalate, sortOn)
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import GHC.RTS.Events
import System.Environment (getArgs)
@dustin
dustin / Starlink.json
Created February 28, 2021 01:22
Starlink Dashboard
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import Criterion (bench, bgroup, whnf)
import Criterion.Main (Benchmark)
import qualified Data.ByteString as BS
import Data.ByteString.Builder (toLazyByteString)
import Data.ByteString.Lazy (toStrict)
@dustin
dustin / dps-box.stl
Created May 15, 2018 05:16
DPS Enclosure
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dustin
dustin / nma.hs
Last active February 5, 2018 06:51
{-# LANGUAGE OverloadedStrings #-}
module NMA where
import Control.Lens
import Control.Monad (guard)
import Data.Semigroup ((<>))
import Network.Wreq (post, FormParam(..), responseBody, responseStatus, statusCode)
import Text.Read (readEither)
import qualified Data.ByteString as BS
@dustin
dustin / Dockerfile
Created November 1, 2017 00:20
Dockerfile for arm linux haskell build environment.
# FROM arm32v7/debian:stretch
FROM resin/rpi-raspbian:stretch
ENV QEMU_SET_ENV=QEMU_CPU=cortex-a9
RUN apt-get update
RUN apt-get install -y netbase curl llvm-3.7 # haskell-stack
RUN curl -sSL https://get.haskellstack.org/ | sh
COPY stack-entry /bin/stack-entry
VOLUME /root
[profile]
layer_height = 0.2
wall_thickness = 1.2
retraction_enable = True
solid_layer_thickness = 0.9
fill_density = 15
print_speed = 40
print_temperature = 200
print_temperature2 = 0
print_temperature3 = 0
@dustin
dustin / ...and results with inlining disabled:
Created July 19, 2016 00:40
Testing interface overhead.
$ go test -gcflags=-l -bench=.
testing: warning: no tests to run
PASS
BenchmarkDirect-4 500000000 3.36 ns/op
BenchmarkInterface-4 1000000000 3.46 ns/op
ok misc/intb 5.830s
volatile bool tx_sumd = false;
volatile bool timedout = false;
// Set tx_sumd = true every 10ms
void initSUMDTimer() {
cli();
TCCR1A = 0;
TCCR1B = 0;
TCNT1 = 0;