Skip to content

Instantly share code, notes, and snippets.

Marek Kubica Leonidas-from-XIV

Block or report user

Report or block Leonidas-from-XIV

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Leonidas-from-XIV /
Created Mar 20, 2019
OPAMFETCH for private archives
#!/usr/bin/env bash
# Adapted and fixed from
# This is an adaptation of code I wrote to download a private binary from GitHub. Such...pain.
# Why can't GitHub just offer a standardized URL you can download a release binary from and attach
# your Github Personal Access Token as a header?
# Since this code is an adaptation it hasn't been directly tested, but the code it was adapted from works
# and hopefully you can get the missing piece you're after by looking here.
View dune-out
File "lib_helpers/", line 1:
Error: The implementation lib_helpers/
does not match the interface lib_helpers/.kafka_helpers.objs/byte/kafka_helpers__Kafka_producer.cmi:
Values do not match:
val stream_to : ('a, unit) sink -> 'a iterable -> unit
is not included in
val stream_to : ('a, 'b) sink -> 'a iterable -> 'b
File "lib_helpers/kafka_producer.mli", line 9, characters 0-48:
Expected declaration
File "lib_helpers/", line 4, characters 4-13:
open Lwt.Infix
open Cohttp
open Cohttp_lwt_unix
let body () =
Client.get (Uri.of_string "") >>= fun (resp, body) ->
let code = resp |> Response.status |> Code.code_of_status in
Lwt_io.printf "Response Code: %d\n" code >>= fun () ->
Lwt_io.printf "Headers: %s\n" (resp |> Response.headers |> Header.to_string) >>= fun () ->
body |> Cohttp_lwt.Body.to_string >>= fun body ->
Leonidas-from-XIV / dune
Created Jan 28, 2019
Dune run custom binary
View dune
;; probably not how to do it
(name bench)
(flags (-safe-string))
(libraries yojson core_bench core))
(name bench)
(deps bench.json)
Leonidas-from-XIV /
Last active Mar 19, 2019
Using Lwt with ppx_let instead of ppx_lwt
module Let_syntax = struct
let return = Lwt.return
let (>>=) = Lwt.Infix.(>>=)
let (>>|) = Lwt.Infix.(>|=)
module Let_syntax = struct
let bind m ~f = Lwt.bind m f
Leonidas-from-XIV /
Created Jul 13, 2018
Looking for a way to handle polymorphic variants
type 'a resp = Handled of unit | Continue of 'a
let handle_x = function Handled () -> Handled () | Continue x -> match x with `X -> Handled () | rest -> Continue rest
let handle_y = function Handled () -> Handled () | Continue x -> match x with `Y -> Handled () | rest -> Continue rest
let handle_xy v = handle_x (handle_y v)
match handle_xy (Continue `X) with
| Handled () -> ()
| Continue v ->
match v with
Leonidas-from-XIV /
Last active Jun 6, 2018
Unifying polymorphic variants
type foo = [`Hello | `World | `Other]
type bar = [`Yet | `Another | `Other]
type baz = [foo | bar]
type qux = Foo of foo | Bar of bar | Quux
let transform = function
| Foo x -> x
| Bar x -> x
View jbuild
((targets (foo_types.mli
(deps (foo.proto))
(action (run ocaml-protoc -int32_type int_t -int64_type int_t -ml_out . ${<}))))
Leonidas-from-XIV / github-iosevka.css
Created Feb 24, 2018
Apply on domain ''
View github-iosevka.css
#files .file .data pre,
#files .file .line-data,
#files .file .line-number,
#readme code,
#readme pre {
font-family: Iosevka, monospace !important;
Leonidas-from-XIV / parser.mly
Created Feb 20, 2018
Shift-reduce conflict with arbitrary resolution
View parser.mly
Warning: one state has shift/reduce conflicts.
Warning: one shift/reduce conflict was arbitrarily resolved.
File "src/variable/parser.mly", line 16, characters 3-3:
Warning: production value_sequence -> is never reduced.
Warning: in total, 1 productions are never reduced.
You can’t perform that action at this time.