This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Foo do | |
use Pipe | |
def maybe({:ok, val}, f), do: f.(val) | |
def maybe({:bad, _} = lhs, f), do: lhs | |
def maybe(_, _), do: raise ArgumentError | |
def dec(num) do | |
if num > 0 do | |
{:ok, num-1} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ocamlscript | |
Ocaml.ocamlflags := ["-g"; "-thread"]; | |
Ocaml.use_camlp4 := false; | |
Ocaml.packs := ["batteries"; "sedlex"] | |
-- | |
open Batteries | |
(* Sedlex lexer definitions *) | |
type token = | |
| Number of int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ocamlscript | |
Ocaml.ocamlflags := ["-g"; "-thread"]; | |
Ocaml.ppopt := ["-pa-ounit-lib"; "fibo"]; | |
Ocaml.packs := ["core"; "cfstream"; "num"; "pa_ounit.syntax"] | |
-- | |
open Core.Std | |
open CFStream | |
let fibo_stream () = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ocp-index support for vim | |
" Maintainer: INAJIMA Daisuke <[email protected]> | |
" Version: 0.1 | |
let s:ocaml_lib_dir = "" | |
let s:jump_history = [] | |
let s:max_jump_history = 100 | |
function! ocpindex#init() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Core.Std | |
let rec fib () = | |
let tmp = ref (0, 1) in | |
let fib_next n = | |
match !tmp with | |
| (cur, next) -> begin | |
tmp := (next, cur+next); | |
Some cur | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@load base/utils/files | |
global conn_files: table[string] of file &synchronized; | |
redef tcp_content_deliver_all_orig = T; | |
redef tcp_content_deliver_all_resp = T; | |
event tcp_contents(c: connection, is_orig: bool, seq: count, contents: string) | |
{ | |
local fname: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static struct nids_chksum_ctl chksum_ctl; | |
int | |
main () | |
{ | |
chksum_ctl.netaddr = 0; | |
chksum_ctl.mask = 0; | |
chksum_ctl.action = NIDS_DONT_CHKSUM; | |
nids_register_chksum_ctl(&chksum_ctl, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# props.conf | |
[ltsv] | |
NO_BINARY_CHECK = 1 | |
SHOULD_LINEMERGE = false | |
REPORT-ltsv = ltsv-extractions | |
TIME_FORMAT=%d/%b/%Y:%H:%M:%S %z | |
TIME_PREFIX=time: | |
# transforms.conf | |
[ltsv-extractions] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import collectd | |
import logging | |
import time | |
from logging.handlers import RotatingFileHandler | |
TIME_FORMAT = "%Y-%m-%d %H:%M:%S" | |
LOGFILE_PATH = "/var/log/collectd/values.log" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from aspen import resources, Response | |
from aspen.resources.negotiated_resource import NegotiatedResource | |
from aspen.testing import assert_raises, attach_teardown, handle, mk, StubRequest | |
from aspen.website import Website | |
from aspen.renderers.tornado import Factory as TornadoFactory | |
def get(**_kw): | |
kw = dict( website = Website([]) | |
, fs = '' |