Skip to content

Instantly share code, notes, and snippets.

View jkachmar's full-sized avatar
🏳️‍⚧️

jkachmar jkachmar

🏳️‍⚧️
View GitHub Profile
@jkachmar
jkachmar / openpgp.md
Last active May 19, 2023 17:05
keyoxide proof and verification

This is an OpenPGP proof that connects my OpenPGP key to this Github account. For details check out https://keyoxide.org/guides/openpgp-proofs

[Verifying my OpenPGP key: openpgp4fpr:0107655cc20afd1a8f3f9872c1782440640bc696]

@jkachmar
jkachmar / Example.hs
Last active October 14, 2021 17:21
Dependency-Injected Servant Client Interpreter
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
@jkachmar
jkachmar / Example.hs
Created August 17, 2021 14:34
Type alias quantification trick for semi-polymorphic effect stacks
{-# LANGUAGE AllowAmbiguousTypes, ConstraintKinds, DataKinds, FlexibleContexts,
FlexibleInstances, FunctionalDependencies, InstanceSigs,
MultiParamTypeClasses, RankNTypes, RecordWildCards, ScopedTypeVariables,
StandaloneKindSignatures, TypeApplications, TypeFamilies,
TypeFamilyDependencies #-}
import Control.Monad.Reader (MonadReader)
import Control.Monad.Trans (MonadTrans)
import Control.Monad.Trans.Except (ExceptT, runExceptT)
import Data.Kind (Constraint, Type)
#########################
# Machine Configuration #
#########################
{ config, inputs, lib, pkgs, unstable, ... }:
{
imports = [
./primary-user-nixos.nix
./desktop-apps.nix
./desktop-kde.nix
@jkachmar
jkachmar / pihole-ftl.nix
Last active June 20, 2020 23:22
Pi-hole FTL derivation
{ fetchFromGitHub, gmp, nettle, sqlite, stdenv }:
let
rev = "3d7c095cb10a1b692c80dd28f6051dea91d45baa";
version = "5.0";
tag = "v${version}";
in
stdenv.mkDerivation {
pname = "pihole-ftl";
@jkachmar
jkachmar / README.md
Created June 13, 2020 16:37
Nix Haskell developPackages Demo

Quickstart

  1. Make a new directory and place the other files at their described paths relative to that directory's root
  • library.DemoLib.hs should be placed at library/DemoLib.hs, gists don't allow a naming convention of library/DemoLib.hs
  1. Run the following command:
nix-shell -E 'let pkgs = import ./pinned.nix {}; pkg =  pkgs.haskellPackages.developPackage { root = ./.; }; in pkg.overrideAttrs (attrs: { buildInputs = attrs.buildInputs ++ [ pkgs.cabal-install]; })'
  1. Run cabal update (to ensure that there's a valid $HOME/.cabal directory with relevant Hackage information, even though we're not going to use it)
  2. Run cabal build and verify that the package builds.
@jkachmar
jkachmar / Total.hs
Created May 13, 2020 17:41
Total prism matching
import Control.Lens hiding (from, to)
import GHC.Generics
class Empty a where
impossible :: a -> x
default impossible :: (Generic a, GEmpty (Rep a)) => a -> x
impossible = gimpossible . from
instance Empty Void where
impossible = absurd
@jkachmar
jkachmar / init.el
Created May 11, 2020 02:08
Emacs config
;;; init.el --- jkachmar's Emacs setup. -*- lexical-binding: t; -*-
;;
;;; Commentary:
;; This file loads use-package, org-mode, and compiles and executes readme.org
;;
;;; Code:
(require 'package)
(setq package-enable-at-startup nil)
@jkachmar
jkachmar / Blap.hs
Last active October 9, 2019 04:02
Madness
newtype ClientInterpreter params m
= ClientInterpreter
( forall response
. params
-> ClientEnv
-> ClientF response
-> ExceptT ServantError m response
)
class HasClientInterpreter (context :: Type -> (Type -> Type) -> Type) where

Keybase proof

I hereby claim:

  • I am jkachmar on github.
  • I am jkachmar (https://keybase.io/jkachmar) on keybase.
  • I have a public key ASDsrA8DW3FUcHdfREv4Ws2lnjzCinJTes8DTm6K72iRcQo

To claim this, I am signing this object: