Skip to content

Instantly share code, notes, and snippets.

View shapr's full-sized avatar
🏃
VENTRE À TERRE

Shae Erisson shapr

🏃
VENTRE À TERRE
View GitHub Profile
;;; orgtimer.el --- show org-agenda when emacs is idle for five minutes
;;; stolen directly from https://www.emacswiki.org/emacs/IdleTimers
;; variable for the timer object
(defvar idle-timer-org nil)
;; callback function
(defun idle-timer-org-callback ()
(org-agenda-list))
;; haskell
(use-package haskell-mode
:ensure t
:init
(progn
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
(setq haskell-process-args-cabal-new-repl
'("--ghc-options=-ferror-spans -fshow-loaded-modules"))
module Main where
import Web.Scotty
main :: IO ()
main = do
scotty 3000 $ do
get "/foo%2C" $ html "you got the url encoded option"
get "/foo," $ html "you got the NOT YET url encoded option"
-- | given a directory for a paper, read that json file into a Paper value
readPaper :: FilePath -> IO (Maybe Paper)
readPaper fp = do
f <- findPaper fp "paper.json"
let f' = listToMaybe f
bs <- mapM BS.readFile f' -- XXX this gonna be a problem at some point XXX
mapM decodeStrict bs -- is this right? do I need this pure? can I concat it with the previous line?
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Data.Aeson
import qualified Data.ByteString.Lazy as BSL
import qualified Data.Text as T
main :: IO ()
all the fio commands from https://askubuntu.com/a/991311/2598
with one of two drives in my laptop:
samsung 970 pro
READ: bw=3295MiB/s (3455MB/s), 3295MiB/s-3295MiB/s (3455MB/s-3455MB/s), io=10.0GiB (10.7GB), run=3108-3108msec
WRITE: bw=2530MiB/s (2653MB/s), 2530MiB/s-2530MiB/s (2653MB/s-2653MB/s), io=10.0GiB (10.7GB), run=4048-4048msec
READ: bw=55.3MiB/s (57.9MB/s), 55.3MiB/s-55.3MiB/s (57.9MB/s-57.9MB/s), io=3316MiB (3477MB), run=60001-60001msec
READ: bw=624KiB/s (639kB/s), 624KiB/s-624KiB/s (639kB/s-639kB/s), io=36.6MiB (38.4MB), run=60004-60004msec
WRITE: bw=624KiB/s (639kB/s), 624KiB/s-624KiB/s (639kB/s-639kB/s), io=36.5MiB (38.3MB), run=60004-60004msec
samsung 970 evo plus
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Main where
import Data.ByteString.Lazy.Char8 (ByteString)
@shapr
shapr / WordCount.lhs
Created January 11, 2020 18:35
Word Count program for a programming languages class
\documentclass{article}
\usepackage[margin=1.5in]{geometry}
\usepackage{fancyhdr}
%include lhs2TeX.fmt
%include lhs2TeX.sty
\pagestyle{fancy}
\lhead{\footnotesize November 1 2012}
\rhead{\footnotesize CS410W -- Word Frequency Count in Haskell -- Shae Erisson}
\begin{document}
\section*{Word frequency count in Haskell}
@shapr
shapr / try.sh
Created February 27, 2020 15:20
my try command wrapper, updated for mac
# for long running commands
function try () {
tally $* && fin || die; # cargo install tally, replacement for time
}
function play_sound () {
afplay $HOME/.bin/$1.wav
}
function notify_success() {
import time
import board
import busio
import adafruit_trellism4
import adafruit_adxl34x
import supervisor
# Set up Trellis and accelerometer
trellis = adafruit_trellism4.TrellisM4Express(rotation=0)
i2c = busio.I2C(board.ACCELEROMETER_SCL, board.ACCELEROMETER_SDA)