Skip to content

Instantly share code, notes, and snippets.

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'
{
services.nginx = {
enable = true;
appendHttpConfig = ''
types {
text/html html;
text/css css;
text/xml xml rss;
image/gif gif;
{-# 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)
{-# LANGUAGE LambdaCase2 #-}
intToBool :: Int -> Maybe Bool
boolToInt :: Bool -> Int
(boolToInt, intToBool) =
\case2
False -> 0
True -> 1
-- | 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/
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
{-# 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, ($>))
~/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 chris@54.166.167.203 \
--switch
{
fonts.fonts = [
pkgs.corefonts
pkgs.fira
pkgs.fira-code
pkgs.fira-mono
pkgs.lato
pkgs.inconsolata
pkgs.symbola
pkgs.ubuntu_font_family
{
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"
'';
}