Skip to content

Instantly share code, notes, and snippets.

View piq9117's full-sized avatar
💀
Nothing good is happening here

piq9117 piq9117

💀
Nothing good is happening here
View GitHub Profile
@piq9117
piq9117 / example.nix
Created January 1, 2023 07:17 — forked from cdepillabout/example.nix
Example of overriding a GHC core Haskell package with Nix
# This file is an example of overriding a GHC core Haskell library (like
# bytestring, containers, text, unix, etc) when building a Haskell package.
let default-nixpkgs =
builtins.fetchTarball {
# nixpkgs haskell-updates branch as of 2019/09/15.
url = "https://github.com/NixOS/nixpkgs/archive/a51b3367ab6acc72630da0bad50ce14fa86996d0.tar.gz";
sha256 = "05d3jxxk5dxzs9b3nan16lhkrjnzf0bjd4xy66az86fsafnrr9rd";
};
in
@piq9117
piq9117 / FSM.hs
Created April 24, 2021 04:55 — forked from adamwespiser/FSM.hs
Finite State Machine ~ in Haskell
{- stack
--resolver lts-16.8
--packages "transformers"
exec ghci
-}
{-# Language
EmptyDataDeriving
, GADTs
, GeneralizedNewtypeDeriving
@piq9117
piq9117 / Main.hs
Created April 8, 2021 00:58 — forked from Gabriella439/Main.hs
Example use of GHC generics to derive datatype parser
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE EmptyDataDeriving #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
@piq9117
piq9117 / io_quickcheck_example.hs
Created March 28, 2021 04:04 — forked from ijt/io_quickcheck_example.hs
Simple example of monadic IO with QuickCheck in Haskell
#!/usr/bin/env runhaskell
-- Synopsis:
-- $ cabal install QuickCheck
-- $ runhaskell io_quickcheck_example.hs
--
-- Author: Issac Trotts <issac.trotts@gmail.com>
import Directory
import System.Environment
@piq9117
piq9117 / test.csv
Last active August 12, 2020 16:59 — forked from suellenstringer-hye/test.csv
sample csv file
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 6.
"first_name","last_name","company_name","address","city","county","state","zip","phone1","phone2","email","web"
"James","Brent","Benton, John B Jr","6649 N Blue Gum St","New Orleans","Orleans","LA",70116,"504-621-8927","504-845-1427","jbrent@gmail.com","http://www.bentonjohnbjr.com"
"Josephine","Darakjy","Chanay, Jeffrey A Esq","4 B Blue Ridge Blvd","Brighton","Livingston","MI",48116,"810-292-9388","810-374-9840","josephine_darakjy@darakjy.org","http://www.chanayjeffreyaesq.com"
"Art","Venere","Chemel, James L Cpa","8 W Cerritos Ave #54","Bridgeport","Gloucester","NJ","08014","856-636-8749","856-264-4130","art@venere.org","http://www.chemeljameslcpa.com"
"Lenna","Paprocki","Feltz Printing Service","639 Main St","Anchorage","Anchorage","AK",99501,"907-385-4412","907-921-2010","lpaprocki@hotmail.com","http://www.feltzprintingservice.com"
"Donette","Foller","Printing Dimensions","34 Center St","Hamilton","Butler","OH",45011,"513-570-1893","513-549-4561","donette.foller@cox.net","http://www.printingdimensions.com
type LoadedData<A> =
<B>(f: (a: A) => B, g: (e: Error) => B, b: B) => B;
function loaded<A>(a: A): LoadedData<A> {
return <B>(f: (a: A) => B, error: (e: Error) => B, empty: B) => f(a);
}
function error<A>(e: Error): LoadedData<A> {
return <B>(success: (a: A) => B, f: (e: Error) => B, empty: B) => f(e);
}
@piq9117
piq9117 / homogenous-array.ts
Created February 24, 2020 05:22 — forked from karol-majewski/homogenous-array.ts
Homogeneous arrays in TypeScript
/**
* @author https://stackoverflow.com/users/2887218/jcalz
* @see https://stackoverflow.com/a/50375286/10325032
*/
type UnionToIntersection<Union> =
(Union extends any
? (argument: Union) => void
: never
) extends (argument: infer Intersection) => void
? Intersection
@piq9117
piq9117 / homogenous-array.ts
Created February 24, 2020 05:22 — forked from karol-majewski/homogenous-array.ts
Homogeneous arrays in TypeScript
/**
* @author https://stackoverflow.com/users/2887218/jcalz
* @see https://stackoverflow.com/a/50375286/10325032
*/
type UnionToIntersection<Union> =
(Union extends any
? (argument: Union) => void
: never
) extends (argument: infer Intersection) => void
? Intersection
@piq9117
piq9117 / i3-gaps_installation_guide.md
Created January 16, 2020 22:07 — forked from boreycutts/i3-gaps_installation_guide.md
A simple installation guide for i3-gaps

Installing i3-gaps

Dependencies

i3-gaps has some packages that are required for it to work so install these things:

sudo apt install libxcb1-dev libxcb-keysyms1-dev libpango1.0-dev libxcb-util0-dev libxcb-icccm4-dev libyajl-dev libstartup-notification0-dev libxcb-randr0-dev libev-dev libxcb-cursor-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev autoconf xutils-dev libtool automake

You also need to install libxcb-xrm-dev, but I got Unable to locate package libxcb-xrm-dev when trying to install from the apt repositories on Ubuntu 16.04. If this happens to you, just install it from source using these commands:

mkdir tmp
@piq9117
piq9117 / gist:06e659563b720e5d505a282b55fa3e40
Created October 31, 2019 22:45 — forked from MaxGabriel/gist:9e757f2da60ac53b45bb06b2b097d86b
persistent-postgresql case insensitive text
-- First enable citext in psql: CREATE EXTENSION IF NOT EXISTS citext;
-- Create Model/CustomTypes.hs
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Model.CustomTypes where