Skip to content

Instantly share code, notes, and snippets.

@actionshrimp
actionshrimp / error.txt
Last active September 10, 2021 09:52
ocamlopt assembler error
$ opam exec -- ocamlopt --version
4.12.0
$ cat int64_test.ml
module Datetime = struct
module Conv (M : sig
val xs_in_a_second : int64
val picos_in_an_x : int64
end) =
$ cat test.ml
type params = {
username: string;
(** Your Github username *)
api_key: string;
(** Your Github API key *)
command: string; [@pos 0] [@docv "CMD"]
(** The Github API command to run *)

Keybase proof

I hereby claim:

  • I am actionshrimp on github.
  • I am actionshrimp (https://keybase.io/actionshrimp) on keybase.
  • I have a public key whose fingerprint is EDB3 240E 95F9 F2B8 A242 51AA FE09 FD07 2937 5918

To claim this, I am signing this object:

@actionshrimp
actionshrimp / indexed-min-heap-error.elm
Created November 26, 2017 18:23
Makes elm-make sad :(
module IndexedMinHeap exposing (empty, insert, deleteMin)
import Array
import Dict exposing (Dict)
import Maybe
import Tuple
type alias IndexedMinHeap comparable comparable1 =
{ heap : Array.Array ( comparable, comparable1 )
@actionshrimp
actionshrimp / list_partition_by_contiguous.ml
Last active November 22, 2017 16:34
Contiguous List.partition_by OCaml
(* Split a list when the predicate changes when comparing two neighbours *)
let partition_by (predicate : 'a -> 'a -> bool) (xs : 'a list) : ('a list) list =
let rec go (cur_x, cur_xs, acc : 'a * ('a list) * (('a list) list)) (xs : 'a list) : ('a list) list =
match xs with
| [] -> (List.rev ((List.rev cur_xs) :: acc))
| x :: xs ->
if predicate x cur_x
then go (x, x :: cur_xs, acc) xs
else go (x, [x], (List.rev cur_xs) :: acc) xs
{-# LANGUAGE RankNTypes #-}
module RankNChurchEncoding where
-- Attempting the exercise at the bottom of the Church Encoding section on
-- https://ocharles.org.uk/blog/guest-posts/2014-12-18-rank-n-types.html
newtype ListC a =
ListC {
foldC :: forall r. (a -> r -> r) -> r -> r
}
; Pick up service x events, sent by error detection in service 'y' stream
(streams
(where (service "x")
;Index API service events for 60s we can watch for expiries info
(with :ttl 60 (update-index (index)))
(changed-state {:init "ok"}
(service-x-state-change-email "errors@email.com"))
(expired (with :state "ok" reinject))))
@actionshrimp
actionshrimp / ToggleGStatus
Created September 9, 2013 09:49
A vim-fugitive status window toggle (mapped to F3). Seems to work nicely
function! ToggleGStatus()
if buflisted(bufname('.git/index'))
bd .git/index
else
Gstatus
endif
endfunction
command ToggleGStatus :call ToggleGStatus()
nmap <F3> :ToggleGStatus<CR>