Skip to content

Instantly share code, notes, and snippets.

View domenkozar's full-sized avatar
💭
I may be slow to respond.

Domen Kožar domenkozar

💭
I may be slow to respond.
View GitHub Profile
/nix/store/83lrbvbmxrgv7iz49mgd42yvhi473xp6-glibc-2.27
/nix/store/i7ywfpigfgsw9fpwkd57sgajz6gacnj7-xz-5.2.4
/nix/store/zjcd71j9cgr040rxbnc7f6kdx38bh2i5-xz-5.2.4-bin
/nix/store/12y8lyrwiaxmhpz6vmdb1rdb3s509q1m-xz-5.2.4-dev
/nix/store/zikcg4s36w5k6fvlba2h4p4riw1qc7fp-gcc-7.3.0-lib
/nix/store/hhzvw77vrmn5f506kfyb1yh1sdinkbwf-gmp-6.1.2
/nix/store/yyv98fx38riz5q2sfhfsqbn6c9byri9y-zlib-1.2.11
/nix/store/4qvrxzxa535y8304mk195x50b6p9607d-binutils-2.30
/nix/store/8zkg9ac4s4alzyf4a8kfrig1j73z66dw-bash-4.4-p23
/nix/store/d6cnw2lkarcx6h7jacla9pb8bfygax4j-expand-response-params
{ config, lib, pkgs, ...}:
with lib;
let
cfg = config.services.batteryNotifier;
in {
options = {
services.batteryNotifier = {
enable = mkOption {
/build/servant-swagger-1.1.5/src/Servant/Swagger.hs:158: failure in expression `hspec $ validateEveryToJSON (Proxy :: Proxy UserAPI)'
expected:
[User]
User
UserId
Finished in ... seconds
3 examples, 0 failures
but got:
[User]
@domenkozar
domenkozar / foo.hs
Created June 23, 2018 16:28
Why does GHC emit warning?
{-# LANGUAGE RecordWildCards #-}
data Foo = Foo
{ a :: Bool
}
run :: Foo -> Bool
run Foo{..}
| a = a
| not a = not a
#!/usr/bin/env nix-shell
#!nix-shell -i runhaskell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [servant-server servant-generic servant-auth-server lens resource-pool sqlite-simple string-conv interpolatedstring-perl6 ])"
#!nix-shell -I /home/ielectric/dev
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE LambdaCase #-}
servant-sub-client.hs:63:22: error:
• Couldn't match type ‘(HomeC :<|> HomePostC)
:<|> (BetC :<|> Bet2C)’
with ‘ClientM Text’
Expected type: HomeC
Actual type: (HomeC :<|> HomePostC) :<|> (BetC :<|> Bet2C)
• In the first argument of ‘runClientM’, namely ‘(bC 3 :: HomeC)’
In a stmt of a 'do' block: res <- runClientM (bC 3 :: HomeC) env
In the expression:
do manager <- newManager defaultManagerSettings
#!/usr/bin/env nix-shell
#!nix-shell -i runghc -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [servant-generic servant-client])"
#!nix-shell -I nixpkgs=http://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE PartialTypeSignatures #-}
#!/usr/bin/env nix-shell
#!nix-shell -i runghc -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [servant-generic servant-client])"
#!nix-shell -I nixpkgs=http://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE UndecidableInstances #-}
#!/usr/bin/env nix-shell
#!nix-shell -i runghc -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [servant-generic servant-client])"
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE OverloadedStrings #-}
# Just put this in your cron (Runs every 1 minute).
# * * * * * /home/YOURUSERNAME/bin/suspend-on-low-battery
source /nix/var/nix/profiles/system/etc/profile
UPOWER=$(nix-build -A upower '<nixpkgs>')/bin/upower
NOTIFY_SEND=$(nix-build -A libnotify '<nixpkgs>')/bin/notify-send
DISPLAY=:0.0
battery_device=`$UPOWER -e | grep -i battery | head -n 1`