Skip to content

Instantly share code, notes, and snippets.

View cljoly's full-sized avatar
If I’m not answering within 7 days, please ping me again!

Clément Joly cljoly

If I’m not answering within 7 days, please ping me again!
View GitHub Profile
#!/usr/bin/env ocamlscript
Ocaml.packs := [ "lambdasoup" ]
--
(* This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
let i = Reader.open_file "each.pi";;
let o = Writer.open_file "each.pi.out";;
o >>= (fun o -> i >>= (fun i -> Reader.read_one_chunk_at_a_time i ~handle_chunk:(fun
str ~pos ~len ->
printf "Pos: %i, Len: %i" pos len;
Bigstring.to_string str
|> String.filter ~f:(function '\n' | '\r' | ' ' -> false | _ -> true)
|> Bigstring.of_string
|> Writer.write_bigstring o;
@cljoly
cljoly / cmd.ml
Last active August 29, 2015 14:26
Using common arguments with Command module of the Core library - Solved
(* Build with:
* corebuild cmd.byte *)
open Core.Std;;
(* With this code, we are trying to
* Define a common set of arguments to be passed to all sub commands
* Handle these common arguments all the same way
* Define sub commands in a common, less verbose way *)
import sys
import markdown
import yaml
import os
from jinja2 import Environment, FileSystemLoader
with open(sys.argv[2], 'r') as f:
content = yaml.safe_load(f.read())
for k in content:
events.js:72
throw er; // Unhandled 'error' event
^
Error: Error: angular-local-storage is not installed. Try running `bower install`.
at /home/lwzukw/Documents/code/forget-me-note/node_modules/wiredep/wiredep.js:30:56
at /home/lwzukw/Documents/code/forget-me-note/node_modules/wiredep/lib/detect-dependencies.js:145:29
at forOwn (/home/lwzukw/Documents/code/forget-me-note/node_modules/wiredep/node_modules/lodash/dist/lodash.js:2106:15)
at Function.forEach (/home/lwzukw/Documents/code/forget-me-note/node_modules/wiredep/node_modules/lodash/dist/lodash.js:3303:9)
at detectDependencies (/home/lwzukw/Documents/code/forget-me-note/node_modules/wiredep/lib/detect-dependencies.js:34:7)

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
$ npm install
npm WARN package.json [email protected] No repository field.
npm WARN optional dep failed, continuing [email protected]
> [email protected] install /home/lwzukw/Documents/code/learnmorse/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make : on entre dans le répertoire « /home/lwzukw/Documents/code/learnmorse/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build »
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
SOLINK_MODULE(target) Release/obj.target/bufferutil.node
$ sudo npm install -g gulp
/usr/bin/gulp -> /usr/lib/node_modules/gulp/bin/gulp.js
[email protected] /usr/lib/node_modules/gulp
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
@cljoly
cljoly / to_test.ml
Last active August 29, 2015 14:21
Beginning with Alcotest
(*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
(* ocamlfind ocamlopt -o exmpl -package curl -linkpkg exmpl.ml *)
open Printf
let _ = Curl.global_init Curl.CURLINIT_GLOBALALL
(*
*************************************************************************
** Aux. functions
*************************************************************************
*)