This file contains 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
''' | |
Demonstration of using `splice` with non-blocking IO | |
Lots of code is similar to 'splice.py', take a look at that module for more | |
documentation. | |
''' | |
import os | |
import os.path | |
import errno |
This file contains 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
import ctypes | |
import ctypes.util | |
c_off_t = ctypes.c_int64 | |
def make_fallocate(): | |
libc_name = ctypes.util.find_library('c') | |
libc = ctypes.CDLL(libc_name) | |
_fallocate = libc.fallocate |
This file contains 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
module Functor = struct | |
module type S = sig | |
type 'a t | |
val map : ('a -> 'b) -> 'a t -> 'b t | |
end | |
module type API = sig | |
include S |
This file contains 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
__pycache__/ | |
.pytest_cache/ |
This file contains 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
dist-newstyle/ |
This file contains 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
> module Paxos.Basic where | |
> import Data.List (maximumBy) | |
> import Data.Maybe (catMaybes) | |
Phase 1a: Prepare | |
================= | |
A Proposer (the leader) creates a proposal identified with a number N. This | |
number must be greater than any previous proposal number used by this Proposer. | |
Then, it sends a Prepare message containing this proposal to a Quorum o |
This file contains 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
module Main (main) where | |
import Data.SBV | |
raadsel :: Symbolic SBool | |
raadsel = do | |
vars@[s, e, n, d, m, o, r, y] <- sIntegers ["s", "e", "n", "d", "m", "o", "r", "y"] | |
-- Helper, maakt bvb. (100 * a + 10 * b + c) uit [a, b, c] | |
let woord w = sum (zipWith (*) (reverse w) (iterate (* 10) 1)) |
This file contains 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
# Some code to retrieve CPUID information in pure Python | |
# | |
# Copyright (C) 2009 Nicolas Trangez <eikke eikke com> | |
# | |
# This library is free software; you can redistribute it and/or | |
# modify it under the terms of the GNU Lesser General Public | |
# License as published by the Free Software Foundation, version 2.1 | |
# of the License. | |
# | |
# This library is distributed in the hope that it will be useful, |
This file contains 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
# <License type="Sun Cloud BSD" version="2.2"> | |
# | |
# Copyright (c) 2005-2009, Sun Microsystems, Inc. | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or | |
# without modification, are permitted provided that the following | |
# conditions are met: | |
# | |
# 1. Redistributions of source code must retain the above copyright |
This file contains 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
type 'a writer = Buffer.t -> 'a -> unit;; | |
type 'a reader = string -> int -> ('a * int);; | |
let ($) a b = a b;; | |
let id x = x;; | |
let lift_llio_writer (l: Buffer.t -> 'b -> unit): ('a -> 'b) -> 'a writer = | |
fun f -> fun b a -> | |
let v = f a in | |
l b v;; |
NewerOlder