Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam Wespiser adamwespiser

View GitHub Profile
@adamwespiser
adamwespiser / RandomExample.hs
Last active Feb 11, 2021
Random Integers from Cryptonite
View RandomExample.hs
{- stack --resolver lts-16.8 --install-ghc exec ghci --package "random cryptonite text memory"-}
{- ghcid -c "stack RandomExample.hs" -}
{-# Language OverloadedStrings, PackageImports, ScopedTypeVariables, TypeApplications #-}
module RandomExample where
import Prelude
import qualified GHC.List as Fold
import "cryptonite" Crypto.Random (MonadRandom, drgNew, withDRG, getRandomBytes)
View Existensial.hs
{- stack --resolver lts-16.8 --install-ghc exec ghci --package "protolude text binary" -}
{-# LANGUAGE DeriveGeneric, DuplicateRecordFields, ExistentialQuantification, FlexibleContexts, RankNTypes, ScopedTypeVariables, StandaloneDeriving #-}
{- ghcid -c "stack X.hs" -}
module Existenial where
import Data.Text
import Data.Binary
import GHC.Generics
@adamwespiser
adamwespiser / FSM.hs
Created Aug 10, 2020
Finite State Machine ~ in Haskell
View FSM.hs
{- stack
--resolver lts-16.8
--packages "transformers"
exec ghci
-}
{-# Language
EmptyDataDeriving
, GADTs
, GeneralizedNewtypeDeriving
View ghc info
tag: ghc-8.8.3-release
ghc is build with
$ ./hadrian/build.stack.sh --flavour=prof --configure -j binary-dist
but I'm just pointing to _build/stage1
stack is version 2.3.1
operating system is macos catalina
View IxMonadT.hs
{- stack script
--resolver lts-14.20
-}
{-# Language RebindableSyntax
, ScopedTypeVariables
, FlexibleInstances
, NoMonomorphismRestriction
, OverloadedStrings
, InstanceSigs
@adamwespiser
adamwespiser / core-dump.hs
Last active Jan 21, 2020
Dive into core ghc 8.6 Conversion
View core-dump.hs
{- stack script
--package "base mtl time ghc ghc-paths haskeline containers"
--resolver lts-14.20
-}
module Main where
-- Compiler
import GHC
import DynFlags
@adamwespiser
adamwespiser / .tmux.conf
Created Jan 6, 2020
Tmux Config + Session Script
View .tmux.conf
# set auto-reload of this config
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
# set default tmux bash version ... move to fish?
set -g default-shell /usr/local/bin/bash
# set colors to 256
set -g default-terminal "screen-256color" # colors!
# start with window 1 (instead of 0)
@adamwespiser
adamwespiser / updateSite.hs
Created Dec 18, 2019
Build script for blog, Haskell version
View updateSite.hs
#!/usr/bin/env stack
{- stack script
--compile
--copy-bins
--resolver lts-14.17
--install-ghc
--package turtle
--package text
--package foldl
--package async
View freshfox_macos
#!/bin/sh -e
alias firefox=/Applications/Firefox.app/Contents/MacOS/firefox
DIR="${XDG_CACHE_HOME:-$HOME/.cache}"
mkdir -p -- "$DIR"
TEMP="$(mktemp -d -- "$DIR/firefox-XXXXXX")"
trap "rm -rf -- '$TEMP'" INT TERM EXIT
firefox -profile "$TEMP" -no-remote "$@"
View conf intervals for point-wise prediction
#https://stats.stackexchange.com/questions/29044/plotting-confidence-intervals-for-the-predicted-probabilities-from-a-logistic-re
library(tidyverse)
library(magrittr)
set.seed(1234)
# create fake data on gambling. Does prob win depend on bid size?
mydat <- data.frame(