Skip to content

Instantly share code, notes, and snippets.

Avatar

Calascibetta Romain dinosaure

View GitHub Profile
View main.ml
let compress stdin stdout =
let jsonm = Jsonm.encoder `Manual in
let o = Bigstringaf.create De.io_buffer_size in
let i = Bytes.create De.io_buffer_size in
let t = Bigstringaf.create De.io_buffer_size in
let stop = ref false in
let rec encode gz = function
| `Partial ->
let len = Bytes.length i - Jsonm.Manual.dst_rem jsonm in
Bigstringaf.blit_from_bytes i ~src_off:0 t ~dst_off:0 ~len ;
@dinosaure
dinosaure / app.ml
Created Apr 19, 2021
`multipart_form` example
View app.ml
open Rresult
open Opium
open Lwt.Infix
let always x _ = x
let index =
let open Tyxml.Html in
html
(head (title (txt "Index")) [])
View main.ml
(* Une explication de [mimic] et de qu'il essaye de résoudre.
[mimic] est une toute petite librairie qui propose une ré-implementation
des méthodes virtuelles pour les modules. Dans un projet large tel que
Git ou Irmin, en gardant l'idée de l'abstraction du système requise pour
être compatible avec MirageOS, une question transcende tout les niveaux:
> comment abstraire le réseau ?
Dans le contexte spécifique Unix/<unistrd.h>, plusieurs fonctions existent
@dinosaure
dinosaure / db.txt
Created Jan 25, 2021
Email database free
View db.txt
stone@meekness.com
ca-tech@dps.centrin.net.id
trinanda_lestyowati@telkomsel.co.id
asst_dos@astonrasuna.com
amartabali@dps.centrin.net.id
achatv@cbn.net.id
bali@tuguhotels.com
baliminimalist@yahoo.com
bliss@thebale.com
adhidharma@denpasar.wasantara.net.id
View functor.ml
type 'a t
val bind : 'a t -> ('a -> 'b t) -> 'b t
val return : 'a -> 'a t
val both : 'a t -> 'b t -> ('a * 'b) t
end
module Make (IO : IO) = struct
let run =
print_endline "Hello World!" ;
View dune
(executable
(name main)
(libraries brr)
(modes js))
(rule (copy main.bc.js main.js))
(alias
(name app)
(deps main.js min.html))
View client.ml
open Lwt.Infix
let ( >>? ) x f =
x >>= function Ok x -> f x | Error err -> Lwt.return (Error err)
let getline queue =
let exists ~predicate queue =
let pos = ref 0 and res = ref (-1) in
Ke.Rke.iter
(fun chr ->
View ann.md

Conduit 3.0.0

I'm glad to announce the new release of [conduit][conduit]. Conduit is, technically, a framework which wants to provide an abstraction of protocols. It permits to implement free-dependencies protocols.

Introduction

The goal of Conduit is the abstraction of protocols. In OCaml, it exists several ways to abstract an implementation from something else. By this way, it

View caml_minilzo.c
#include "minilzo.h"
#include <caml/bigarray.h>
#include <stdio.h>
#ifndef __unused
#define __unused(x) x __attribute__((unused))
#endif
#define __unit() value __unused(unit)
View shift.c
#include <stdio.h>
void shift(unsigned char *a, int size, int shift) {
int carry = 0 ;
while (shift--) {
carry = 0;
for (int i = size - 1; i >= 0; i--) {
int next = (a[i] & 1) ? 0x80 : 0 ;