Skip to content

Instantly share code, notes, and snippets.

@cdepillabout
cdepillabout / README.md
Created April 22, 2020 02:02
shell.nix to enable training ML models remotely with the GCP AI Platform
@cdepillabout
cdepillabout / continuations.hs
Created January 5, 2021 05:38
Examples of playing around with continuations in Haskell
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Example where
import Control.Concurrent.MVar
import Control.Monad.IO.Class
import Control.Monad.Trans.Cont
import Data.Foldable
import Data.Monoid
@cdepillabout
cdepillabout / transformers-tests.hs
Last active January 24, 2021 03:24
examples of output of various monadic functions with different monad transformer orders
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Monad.Except
import Control.Monad.State
import Control.Monad.Writer
import Data.Functor.Identity
import Data.Text (Text)
@cdepillabout
cdepillabout / shell.nix
Last active May 7, 2024 13:49
shell.nix for Python development using virtualenv and pip
let
nixpkgs-src = builtins.fetchTarball {
# master of 2021-01-05.
url = "https://github.com/NixOS/nixpkgs/archive/1a57d96edd156958b12782e8c8b6a374142a7248.tar.gz";
sha256 = "1qdh457apmw2yxbpi1biwl5x5ygaw158ppff4al8rx7gncgl10rd";
};
pkgs = import nixpkgs-src {
config = {
# allowUnfree may be necessary for some packages, but in general you should not need it.
@cdepillabout
cdepillabout / fetch-dhall-as-binary.nix
Created September 14, 2021 06:23
demonstrate how to fetch URL imports in Dhall by turning the integrity checks into Nix fixed-output-derivations
with import <nixpkgs> {};
let
packageSet = fetchurl {
url = "https://github.com/purescript/package-sets/releases/download/psc-0.14.4-20210905/packages.dhall";
# The hash below is a base64-encoded version of the base-16 hash that is
# specified in our local packages.dhall file:
# ```
# $ cat packages.dhall
# let upstream =
@cdepillabout
cdepillabout / nix-build-output.md
Last active December 16, 2021 05:31
pkgsMusl.postgresql test fail
$ nix build -L .#pkgsMusl.postgresql
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/j76apgvazybh6fhiif7yj67xnfj6x7fr-postgresql-13.4.tar.bz2
source root is postgresql-13.4
setting SOURCE_DATE_EPOCH to timestamp 1628543016 of file postgresql-13.4/INSTALL
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
applying patch /nix/store/zv4waczq5k45138d2sdy7dyidas90lhh-disable-resolve_symlinks-94.patch
@cdepillabout
cdepillabout / FizzBuzzOne.hs
Last active December 28, 2022 00:55
type-level fizzbuzz in Haskell with singletons
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}