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 / 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
intersperseVec :: a -> Vector a -> Vector a
intersperseVec sep vec = V.cons ( V.head vec )
$ foldr (\v accum -> V.cons sep $ V.cons v accum) V.empty ( V.tail vec )
@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
{ stdenv, fetchzip }:
stdenv.mkDerivation rec {
name = "godot-mono";
version = "3.1.2";
src = fetchzip {
url = "https://downloads.tuxfamily.org/godotengine/${version}/mono/Godot_v${version}-stable_mono_x11_64.zip";
sha256 = "0lzl9kin9pckcdl262fp4kfybjx0fbj79954xmz75jqazwgnp0dd";
extraPostFetch = ''
@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