Skip to content

Instantly share code, notes, and snippets.

View chessai's full-sized avatar

chessai chessai

View GitHub Profile
{ stdenv, fetchFromGitHub, pkgconfig, vpnc, openssl ? null, gnutls ? null, gmp, libxml2, stoken, zlib } :
assert (openssl != null) == (gnutls == null);
let
version = "7.08";
name = "openconnect_pa-${version}";
in stdenv.mkDerivation {
inherit name;
gm (middle of line)
% (match of next brace, bracket, comment, #define)
@chessai
chessai / cpp_hell.hs
Last active December 17, 2019 14:07
{-# LANGUAGE CPP #-}
#define InnieOuttie IO
#define class module
#define begin where
#define mayo main
#define memo putStrLn
@chessai
chessai / dmap_aeson_orphan.hs
Created November 30, 2018 20:21
aeson instances for dmap
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE RankNTypes #-}
{-# OPTIONS_GHC -Wall -Werror -fno-warn-orphans #-}
module Data.Dependent.Map.JSON () where
import Data.Aeson (ToJSON(..),FromJSON(..))
import Data.Exists (Exists(..),ToJSONKeyForall(..),
ToJSONKeyFunctionForall(..),ToJSONForall(..),ToSing(..),
http://www.eas.uccs.edu/~mwickert/ece5655/lecture_notes/ece5655_chap10.pdf
@chessai
chessai / bash.bash
Last active December 10, 2018 16:48
example of setting up a nixos service on a non-nixos machine
# a simple service, 'mysql'
$ cat example.nix
{ pkgs, ... }:
{
services.mysql.enable = true;
services.mysql.package = pkgs.mysql;
}
# build the service
@chessai
chessai / Main.hs
Created December 12, 2018 18:05
Averaged across persons, excluding legal fees, how much money had each person spent by time 6?
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main (main) where
import Colonnade (Headed)
import Data.ByteString (ByteString)
import Data.Map (Map)
import Data.Text (Text)
import Siphon (Siphon, SiphonError)
@chessai
chessai / rank2catmaybes.hs
Last active December 13, 2018 15:05
catMaybes for any rank2-traversable type that contains a maybe
{-# LANGUAGE RankNTypes #-}
module Rank2CatMaybes (catMaybes) where
import Data.Coerce (coerce)
import Data.Functor.Identity (Identity(Identity))
import qualified Rank2
liftId :: (forall x. x -> Identity x)
liftId = coerce
owner = "chessai"
fullName = "chessai"
email = "[email protected]"
license = "BSD3"
lib = true
exe = false
test = true
bench = false
github = true
private = false
@chessai
chessai / foo.core
Last active January 9, 2019 17:37
fixedparser core output example
-- | ghc foo.hs -ddump-simpl -dsuppress-all -fforce-recomp -O2
[1 of 1] Compiling ParseFoo ( foo.hs, foo.o )
==================== Tidy Core ====================
Result size of Tidy Core
= {terms: 260, types: 105, coercions: 10, joins: 0/3}
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
$trModule4