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 Data.List | |
import Data.String | |
import Data.Char | |
import Data.Maybe | |
import GHC.Int | |
import qualified Data.Text.Lazy as T | |
import qualified Data.Text.Lazy.IO as TI | |
import qualified Data.Map.Strict as M |
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
» Fri Jul 27 23:32 2018 Time and Allocation Profiling Report (Final) | |
» code +RTS -p -h -M1000m -RTS | |
» total time = 0.27 secs (274 ticks @ 1000 us, 1 processor) | |
» total alloc = 1,196,325,952 bytes (excludes profiling overheads) | |
COST CENTRE MODULE SRC %time %alloc | |
clumps Main code.hs:(18,1)-(43,38) 51.8 28.3 |
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
» Fri Jul 27 23:43 2018 Time and Allocation Profiling Report (Final) | |
» code +RTS -p -h -M1000m -RTS | |
» total time = 0.60 secs (596 ticks @ 1000 us, 1 processor) | |
» total alloc = 1,826,831,176 bytes (excludes profiling overheads) | |
COST CENTRE MODULE SRC %time %alloc | |
clumps.slideInsert Main code.hs:(24,7)-(26,121) 51.2 54.3 |
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
clumps :: (Num a, Ord a) => GHC.Int.Int64 -> GHC.Int.Int64 -> a -> T.Text -> [T.Text] | |
clumps k l t text = M.keys $ M.filter (>=t) $ (\(m,_,_,_) -> m) $ T.foldl' | |
(\x y -> slideDrop $ slideInsert x y) | |
(M.singleton prefix 1, prefix, prefix, k) | |
text' | |
where | |
(prefix, text') = T.splitAt k text | |
slideInsert (m, word, window, delay) c = let wtail = (snd . fromJust . T.uncons) word | |
word' = T.snoc wtail c |
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 BangPatterns #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
module Main where | |
-- parsing arguments | |
import Control.Exception | |
import Control.Monad | |
import Data.Semigroup ((<>)) | |
import Options.Applicative |
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
#!/bin/python3 | |
# Convert an mpd.db file into jsonlines. | |
# Example usage: | |
# | |
# > parse-mpd.py /nfs/music | sqlite-utils insert --alter --nl music mpd.sqlite3 music - | |
# | |
# Based on: https://github.com/Delapouite/mpdump | |
# | |
# NOTE: If your Artist, Album, or Track names start/end with " ", |
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
# Works with "darwin" and "linux" | |
OS := $(shell uname | tr '[:upper:]' '[:lower:]') | |
ARCH := $(shell uname -m) | |
# Create a local bin | |
BIN := /usr/local/bin | |
# Most of the binaries just grab the latest version. | |
# For better, or for worse! | |
TERRAFORM_VERSION := 1.0.6 |
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
#!/bin/sh | |
# Re-Authenticate all vault tokens. | |
# Dependencies: jq, curl | |
# Example: | |
# | |
# $ bash vault-renew.sh | |
# { | |
# "minio_gateway_premium": { | |
# "accessKeyId": "profile-blair-drummond-XXXXXXXXXXXXXXXX", |