Skip to content

Instantly share code, notes, and snippets.

# Enable some user level services
systemd.user.services = {
status-notifier-watcher = {
enable = true;
description= "status notifier watcher";
wantedBy = [ "default.target" ];
before = [ "taffybar.service" ];
serviceConfig = {
Type = "simple";
@mankyKitty
mankyKitty / had_to_try.hs
Last active March 20, 2019 22:40
generalised hedgehog command, so you don't have to keep rewriting `HTraversable` instances, maybe...
-- *sniff sniff* .. I smell, overkill
type family CmdArg (a :: k) :: Type
-- Totally overdone, but you can use promoted types for a bit of fun...
-- I don't use the promoted type here, but could be nice for flexibility later, maybe.
data Cmd (a :: k) (v :: Type -> Type) where
Cmd :: Show (CmdArg a) => CmdArg a -> Cmd a v
deriving instance Show (Cmd a v)
@mankyKitty
mankyKitty / StateAPI.hs
Last active February 28, 2019 00:43
wweeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
{-# LANGUAGE RankNTypes #-}
module StateAPI where
import Control.Lens (Lens', cons, lens, (%~))
import Control.Monad.IO.Class (MonadIO)
import Data.Function ((&))
import Data.Typeable (Typeable)
import Hedgehog
@mankyKitty
mankyKitty / state_fns.hs
Last active February 27, 2019 04:56
messing around with different api for hedgehog state machine tests
cSetDrinkCoffee3
:: forall g m. (MonadGen g, MonadTest m, MonadIO m)
=> C.Machine
-> Command g m Model
cSetDrinkCoffee3 mach = emptyCmd (alwaysGen SetDrinkCoffee) exec
& flip require (\(Model dtype) _ -> dtype == Coffee)
& flip ensure (\_ _ _ out -> case out of
C.Coffee {} -> success
_ -> failure
)
@mankyKitty
mankyKitty / stack.yaml
Created January 15, 2019 00:25
stack without the .... well, stack
resolver: ghc-8.4.3
system-ghc: true
install-ghc: false
@mankyKitty
mankyKitty / default.nix
Created August 1, 2018 05:15
Nix expression for building vscode on nixos with a specific list of extensions
{ pkgs ? import <nixpkgs> {}
}:
with pkgs;
let
hie =
import (fetchTarball "https://github.com/puffnfresh/hie-nix/archive/6b1fd52e4946dc0d94c7892238d06be51a079d31.tar.gz") { inherit pkgs; };
hieWrapper = writeShellScriptBin "hie" ''
argv=( "$@" )
@mankyKitty
mankyKitty / get_vscode_ext_updates_nixy.sh
Last active August 1, 2018 05:06
Bashy way to request nix style sets for us in the `vscodeWithExtensions` nix expression.
#! /usr/bin/env bash
CODE=$(pwd)/result/bin/code
function get_ver() {
curl --silent "https://raw.githubusercontent.com/$1/$2/master/package.json" | grep '"version":' | awk '{ print $2 }' | tr -d '[:alpha:]", :'
}
function get_vsixpackage_sha() {
URL="https://$1.gallery.vsassets.io/_apis/public/gallery/publisher/$1/extension/$2/latest/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage"
-- Given [a,b] - Gives [a,b,a,b]
wutDecoder :: Monad f => Decoder f [Int]
wutDecoder = withCursor $ \curs -> do
-- Move into the array
x <- down curs
-- Decode first
a <- int pint x
-- Step to the right
x' <- moveRightN 1 x
-- Decode that one
@mankyKitty
mankyKitty / CoverHog.hs
Last active June 27, 2018 05:15
initial coverage tracking for hedgehog tests. :D
data Tally = Tally
{ _tallyTally :: Map Text Int
}
deriving (Eq, Show)
makeLenses ''Tally
newtype CoveredProperty = PC
{ unPC :: PropertyT (StateT Tally IO) ()
}
@mankyKitty
mankyKitty / Seppy.hs
Created June 14, 2018 04:00
Separated things using separated with optional trailing comma.
module Seppy where
import Control.Applicative (liftA2, (<$>), (<*>), (<*), (<*), (<|>))
import Data.Char (Char)
import Data.Foldable (asum)
import Text.Parser.Char (CharParsing, char,alphaNum)
import Text.Parser.Combinators (try,many)