This file contains hidden or 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
isHex :: Word8 -> Bool | |
isHex w = | |
(w >= 48 && w <= 57) || -- '0' to '9' | |
(w >= 97 && w <= 102) || -- lower-case 'a' to 'f' | |
(w >= 65 && w <= 70) -- upper-case 'A' to 'F' |
This file contains hidden or 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
{ | |
services.nginx = { | |
enable = true; | |
appendHttpConfig = '' | |
types { | |
text/html html; | |
text/css css; | |
text/xml xml rss; | |
image/gif gif; |
This file contains hidden or 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 LambdaCase #-} | |
import Data.IORef | |
import Data.Map (Map) | |
import qualified Data.Map as Map | |
import Numeric.Natural | |
type Cache a b = IORef (Map a b) | |
newCache :: IO (Cache a b) |
This file contains hidden or 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 LambdaCase2 #-} | |
intToBool :: Int -> Maybe Bool | |
boolToInt :: Bool -> Int | |
(boolToInt, intToBool) = | |
\case2 | |
False -> 0 | |
True -> 1 |
This file contains hidden or 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
-- | A string we're looking for in the source. | |
-- | |
-- /Mnemonic: "needle in a haystack"/ | |
newtype Needle = Needle Strict.Text | |
deriving Eq | |
-- | Needles are sorted by length with the longest needles first. | |
-- | |
-- We use this ordering when performing replacements. For example, if both | |
-- "a" and "ab" are needles, then we give "ab" a chance to be found /before/ |
This file contains hidden or 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 qualified Data.Text as Strict (Text) | |
import qualified Data.Text as StrictText | |
import qualified Data.Text.Lazy as Lazy (Text) | |
import qualified Data.Text.Lazy as LazyText |
This file contains hidden or 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 OverloadedLists #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
module Wrap where | |
import Control.Arrow ((>>>)) | |
import Data.Bool (not, (||)) | |
import Data.Char (isSpace) | |
import Data.Function ((&)) | |
import Data.Functor (fmap, ($>)) |
This file contains hidden or 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
~/haskell/nix-deploy/result/bin/nix-deploy system \ | |
--path (env NIXOS_CONFIG=$PWD/webserver1.nix nix-build '/home/chris/nix/path/unstable/nixos' -A system --no-out-link) \ | |
--to [email protected] \ | |
--switch |
This file contains hidden or 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
{ | |
fonts.fonts = [ | |
pkgs.corefonts | |
pkgs.fira | |
pkgs.fira-code | |
pkgs.fira-mono | |
pkgs.lato | |
pkgs.inconsolata | |
pkgs.symbola | |
pkgs.ubuntu_font_family |
This file contains hidden or 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
{ | |
global-css = runCommand "style-global" { } '' | |
cat "${constants-scss}" "${./global.scss}" | "${sassc}/bin/sassc" > "$out" | |
''; | |
global-js = runCommand "script-global" { } '' | |
cat "${./global.js}" | ${minify}/bin/minify --type=js > "$out" | |
''; | |
} |