Skip to content

Instantly share code, notes, and snippets.

View jonathanlking's full-sized avatar

Jonathan King jonathanlking

View GitHub Profile
@adamgundry
adamgundry / GenericDiscrimination.hs
Created March 4, 2020 22:13
Being a horrible abuse of INCOHERENT to determine whether Generic instances exist
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
@dysinger
dysinger / nixos-encrypted-zfs.sh
Last active March 7, 2023 14:51
How I installed Encrypted ZFS root on NixOS
# MOVED HERE https://gist.github.com/dysinger/2a768db5b6e3b729ec898d7d4208add3
@justinwoo
justinwoo / purs-11.7-to-12-guide.md
Last active January 6, 2019 16:34
See the PureScript Resources guide page at https://purescript-resources.readthedocs.io/en/latest/0.11.7-to-0.12.0.html. PureScript 0.11.7 -> PureScript 0.12.0 checklist

There are some changes you will need to make for most applications to be upgraded to PureScript 0.12. With some usage of editor commands, you should be able to convert any 20K LOC codebase in less than an hour.

Libraries

  • Remove eff, install effect
  • Remove dom and dom-*, use web-dom and such from purescript-web. Use type holes (?whatmethod) to discover new APIs
@DanBurton
DanBurton / stack.yaml
Last active September 24, 2018 01:51
stack.yaml with "setup-info" for ghc-8.6.1-beta1 (aka ghc-8.6.0.20180810)
# Generated from https://gist.github.com/DanBurton/5b7fc5fae1ebfdc5bcaecfbac15d2903
setup-info:
ghc:
windows32:
8.6.0.20180810:
url: https://downloads.haskell.org/~ghc/8.6.1-beta1/ghc-8.6.0.20180810-i386-unknown-mingw32.tar.xz
sha256: 9be35662d510d3489ddd583e7d9d38ee6b6ba40b852f6e90e0dfd97a0d7bbfd3
linux32-nopie:
8.6.0.20180810:
@SeanSobey
SeanSobey / .gitattributes
Last active November 4, 2022 08:57
Git to diff zip (or any compressed) files. See this (https://tante.cc/2010/06/23/managing-zip-based-file-formats-in-git/) article.
*.[7z,xz,bzip2,gzip,tar,zip,wim,ar,arj,cab,chm,cpio,cramfs,dmg,ext,fat,gpt,hfs,ihex,iso,lzh,lzma,mbr,.msi,nsis,ntfs,qcow2,rar,rpm,squashfs,udf,uefi,vdi,vhd,vmdk,wim,xar,z] diff=archive
@colophonemes
colophonemes / create_triggers
Last active February 17, 2024 15:15
Postgres TRIGGER to call NOTIFY with a JSON payload
CREATE TRIGGER person_notify AFTER INSERT OR UPDATE OR DELETE ON income
FOR EACH ROW EXECUTE PROCEDURE notify_trigger(
'id',
'email',
'username'
);
CREATE TRIGGER income_notify AFTER INSERT OR UPDATE OR DELETE ON income
FOR EACH ROW EXECUTE PROCEDURE notify_trigger(
'id',
@Icelandjack
Icelandjack / Constraints.org
Last active April 2, 2024 20:22
Type Classes and Constraints

Reddit discussion.

Disclaimer 1: Type classes are great but they are not the right tool for every job. Enjoy some balance and balance to your balance.

Disclaimer 2: I should tidy this up but probably won’t.

Disclaimer 3: Yeah called it, better to be realistic.

Type classes are a language of their own, this is an attempt to document features and give a name to them.

@wangruohui
wangruohui / Install NVIDIA Driver and CUDA.md
Last active May 17, 2024 09:02
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
module Main where
import Data.Functor.Foldable
import Data.Maybe
g :: (Ord a, Num a) => (a, [[a]]) -> Prim [Maybe a] (a, [[a]])
g (n, xs)
| n `elem` concatMap (take 1) xs'
= Cons Nothing (n + 2, xs')
| otherwise
@efeciftci
efeciftci / strtok_example.c
Last active October 25, 2021 04:28
An example that shows usage of strtok function in C programming language.
/*
* The following description is from Linux Programmer's Manual (strtok(3)):
*
* #include <string.h>
* char *strtok(char *str, const char *delim);
*
* The strtok() function breaks a string into a sequence of zero or more
* nonempty tokens. On the first call to strtok() the string to be parsed
* should be specified in str. In each subsequent call that should parse
* the same string, str must be NULL.