Skip to content

Instantly share code, notes, and snippets.

module Abstract_value :
sig
type t
val create : unit -> t
end =
struct
type t = unit -> unit
let create () =
(*
Compile with:
ocamlfind opt -package ketrew -thread -linkpkg k4people.ml -o k4people
*)
open Nonstd
let (//) = Filename.concat
@smondet
smondet / archive_sql_query.ml
Created March 17, 2016 19:39
Create a Trakeva-friendly SQL query to archive nodes.
#use "topfind";;
#thread;;
#require "ketrew";;
open Nonstd
module String = Sosa.Native_string
let escape_blob s =
let b = Buffer.create (String.length s * 2 + 4) in
Buffer.add_string b "X'";
String.iter s ~f:(fun c ->
@smondet
smondet / skill
Created November 11, 2015 18:11
Kill Stuff by name
#!/bin/bash
#
# Copyright (c) 2006 by Sebastien Mondet.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
#! /bin/sh
SCRIPT_NAME=$(basename $0)
short_usage()
{
echo "Cf : $SCRIPT_NAME [--help]"
}
long_usage()
{
(add-to-list 'sebs-packages 'tuareg)
(setq opam-share
(substring
(shell-command-to-string "opam config var share 2> /dev/null") 0 -1))
(add-to-list 'load-path (concat opam-share "/emacs/site-lisp"))
(require 'merlin)
(setq ocp-indent-config "strict_with=always,with=0,strict_comments=false")
(require 'ocp-indent)
(add-to-list 'auto-mode-alist '("\\.eliom" . tuareg-mode))
" ### Ocaml
" Get the opam directories:
let opam_prefix_ = system('echo -n "$(opam config var prefix)"')
let opam_prefix = substitute(opam_prefix_,'^\s*\(.\{-}\)\s*$', '\1', '') " This strips the string
" #### merlin
if filereadable(opam_prefix . '/share/ocamlmerlin/vim/doc/merlin.txt')
exec 'set rtp+=' . opam_prefix . '/share/ocamlmerlin/vim'
exec 'set rtp+=' . opam_prefix . '/share/ocamlmerlin/vimbufsync'
exec 'helptags ' . opam_prefix . '/share/ocamlmerlin/vim/doc'
type (_,_) safety = Safe : ('a,'a option) safety | Unsafe : ('a,'a) safety
let ios: type a. (int, a) safety -> string -> a = fun safety s ->
match safety with
| Safe -> (try Some (int_of_string s) with _ -> None)
| Unsafe -> int_of_string s
let () =
assert (ios Safe "dskljf" = None);
(*D
Trying CConv
============
See
[`c-cube/cconv`](https://github.com/c-cube/cconv)
For now, it is experimental:
# example .ensime generation
# Maven to Ensime config. convertor:
#
# Prints .ensime configuration for Maven project.
#
# USAGE:
# mvn-ensime PROJECT_NAME PROJECT_PACKAGE ROOT_DIR TARGET_DIR SOURCE_DIRS*
#
python mvn-ensime.py adam org.bdgenomics.adam \