Skip to content

Instantly share code, notes, and snippets.

View adetokunbo's full-sized avatar

Timothy Emiola adetokunbo

  • Itoshima, Japan
View GitHub Profile
@adetokunbo
adetokunbo / the-algebra-of-algebraic-data-types.md
Created May 12, 2019 12:32 — forked from gregberns/the-algebra-of-algebraic-data-types.md
The Algebra of Algebraic Data Types, Part 1, by Chris Taylor
@adetokunbo
adetokunbo / GHCI calc
Last active April 19, 2019 08:13
Weights calculation in GHCi
λ> map round $ drop 1 $ take 85 $ scanl (*) 1 (repeat $ 10 ** (logBase 10 2 / 7))
[1,1,1,1,2,2,2,2,2,3,3,3,4,4,4,5,5,6,7,7,8,9,10,11,12,13,14,16,18,20,22,24,26,29,32,35,39,43,48,53,58,64,71,78,86,95,105,116,128,141,156,172,190,210,232,256,283,312,345,380,420,464,512,565,624,689,761,840,927,1024,1131,1248,1378,1522,1680,1855,2048,2261,2497,2756,3043,3360,3710,4096]
@adetokunbo
adetokunbo / prismatic.hs
Created February 13, 2019 03:09 — forked from parsonsmatt/prismatic.hs
I figured out a nice way to pluck exceptions out of a constraint!
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
@adetokunbo
adetokunbo / Create-branch-with-Github-API.md
Created August 28, 2018 10:22 — forked from Potherca/README.md
Create a branch on Github without access to a local git repo using http://hurl.eu/

Ever had the need to create a branch in a repo on Github without wanting (or being able) to access a local repo?

With the aid of [the Github API][1] and [hurl.eu][2] this is a piece of cake!

Just follow these steps:

  1. Open [http://hurl.eu/][2]
  2. Find the revision you want to branch from. Either on Github itself or by doing a GET request from Hurl: https://api.github.com/repos/<AUTHOR>/<REPO>/git/refs/heads
  3. Copy the revision hash
  4. Do a POST request from Hurl to https://api.github.com/repos///git/refs with the following as the POST body :
@adetokunbo
adetokunbo / nix-err.bash
Created August 6, 2018 03:37
Error in nix-build
/nix/store/86qf079p48fbh620wszkdsz8hkv3rq9n-clang-wrapper-5.0.2/bin/cc: line 183: /nix/store/mmyhyb507zmy44mdamk6csc4pc0d8vx5-clang-5.0.2/bin/clang: Argument list too long
`cc' failed in phase `Linker'. (Exit code: 126)
@adetokunbo
adetokunbo / Common.hs
Created July 19, 2018 21:32
Beam instances for a newtype of Text
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
#!/usr/bin/env nix-shell
#!nix-shell -i runhaskell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [servant-server servant-generic servant-auth-server lens resource-pool sqlite-simple string-conv interpolatedstring-perl6 ])"
#!nix-shell -I /home/ielectric/dev
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE LambdaCase #-}
@adetokunbo
adetokunbo / redirect.hs
Created June 26, 2018 04:07 — forked from alpmestan/redirect.hs
servant redirects, new generation
{-
$ curl -X POST localhost:9876/dog -v
* Connected to localhost (127.0.0.1) port 9876 (#0)
> POST /dog HTTP/1.1
> Host: localhost:9876
> User-Agent: curl/7.55.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Transfer-Encoding: chunked
@adetokunbo
adetokunbo / configure.sh
Last active June 22, 2018 00:24 — forked from LnL7/configure.sh
darwin nix-daemon distributed builds
#!/usr/bin/env bash
sudo mkdir -p /nix/run/nix/current-load
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo curl -fsSL -o /Library/LaunchDaemons/org.nixos.nix-daemon.plist https://gist.githubusercontent.com/adetokunbo/bd4d36d147445168d1eb186d73765a59/raw/249be6a9c44b7804ca960ec364cc393477422315/org.nixos.nix-daemon.plist
sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist
# Configure /etc/nix/machines
# Make sure root can ssh to the builder (known_hosts etc.)
@adetokunbo
adetokunbo / cabal.json
Last active April 1, 2018 08:04
Diff attempting to add newer version of cabal-install as an override
{
"url": "https://github.com/haskell/cabal.git",
"rev": "4cc8f433f87c31d395253d688e84cc3d490259a3",
"date": "2018-03-29T09:23:57+01:00",
"sha256": "10k070phllll7wl976xgakhmfh494gp7xws6jwj434vzggs5p4ln",
"fetchSubmodules": true
}