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 / 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 :
#!/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.)
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecursiveDo #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TemplateHaskell #-}
-- | Demo:
-- | 1) config and state (model) accessible everywhere without pushing
-- parameters around in a reflex app.
-- | 2) Pushing more than one event to 'EventWriter' and using
-- 'coincidence' to extract them.
@adetokunbo
adetokunbo / autotools.nix
Created March 22, 2018 06:19 — forked from lucabrunox/autotools.nix
Nix pill 10
pkgs: attrs:
with pkgs;
let defaultAttrs = {
builder = "${bash}/bin/bash";
args = [ ./builder.sh ];
setup = ./setup.sh;
baseInputs = [ gnutar gzip gnumake gcc binutils coreutils gawk gnused gnugrep patchelf findutils ];
buildInputs = [];
system = builtins.currentSystem;
};
@adetokunbo
adetokunbo / Main.hs
Created March 20, 2018 05:50 — forked from mightybyte/Main.hs
Attaching reflex to a particular node
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RecursiveDo #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
------------------------------------------------------------------------------
import Control.Concurrent
import Control.Monad
import Control.Monad.Trans
@adetokunbo
adetokunbo / LocalStorage.hs
Created March 17, 2018 09:18 — forked from blargg/LocalStorage.hs
Using javascript function with Reflex and JSaddle
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ExtendedDefaultRules #-}
import Reflex.Dom
import Control.Monad.IO.Class
import Control.Monad (void)
import Data.Text (Text)
import Language.Javascript.JSaddle
import Control.Lens ((^.))
main :: IO ()
@adetokunbo
adetokunbo / .ghci
Created March 16, 2018 02:31 — forked from 3noch/.ghci
Reflex-DOM Auto Reload Development with ghcid
:set prompt "> "
:set -isrc
:load Main