Skip to content

Instantly share code, notes, and snippets.

View astrada's full-sized avatar

Alessandro Strada astrada

View GitHub Profile
let with_session
config
curl_state
interact =
let curl_session = GapiCurl.init curl_state in
let writer data = String.length data in
GapiCurl.set_writefunction writer curl_session;
let cleanup () = ignore (GapiCurl.cleanup curl_session) in
let session =
{ GapiConversation.Session.curl = curl_session;
#!/bin/bash
TARGET_FILE="/tmp/gdfuse.mem.log"
PROCESS_NAME=${1:-"google-drive-ocamlfuse"}
PID=$(ps -C "$PROCESS_NAME" -o pid=)
PID=${PID## }
if [[ -e "$TARGET_FILE" ]]
then
rm "$TARGET_FILE"
@astrada
astrada / monad_try.ml
Created December 23, 2012 15:02
Monads and exception handling in OCaml
(* Tested with OCaml 3.12.1/4.00.1 *)
(* A standard state monad with an integer state *)
module IntStateMonad =
struct
type 'a t = int -> 'a * int
(* val return : 'a -> 'a t *)
let return (x : 'a) : 'a t =
(fun s -> (x, s))