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
#!/bin/awk -f | |
BEGIN { | |
total = 0 | |
good = 0 | |
} | |
{ | |
total += length | |
gsub(/[^()]/, "") | |
good += length |
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
<h1>A HTML combinator library proposition</h1> | |
> {-# LANGUAGE OverloadedStrings #-} | |
This is a proposal for a HTML combinator interface library. I'm writing this | |
document because I would like feedback and pointers on the API before I actually | |
start coding it. | |
> import Control.Monad.Reader | |
> import Control.Monad.State |
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
{-# LANGUAGE OverloadedStrings, GeneralizedNewtypeDeriving, FlexibleInstances, TypeSynonymInstances #-} | |
-- | Another draft of an API for a blazingly fast Html generation library. | |
-- | |
-- Here we take the following approach. | |
-- | |
-- (1) We define a Html typeclass for the basic combinators required to build | |
-- well-formed Html documents. Part of their semantics is defined by | |
-- equalities they satisfy. | |
-- | |
-- (2) Based upon these combinators we build the whole set of combinators |
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
-- | Viterbi algorithm in Haskell, legacy of my course on bio-informatics. | |
-- | |
module Viterbi where | |
import Data.Ord (comparing) | |
import Data.Maybe (fromJust) | |
import Data.List (sort, maximumBy) | |
import Data.Map (Map) | |
import qualified Data.Map as M |
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
#include <stdio.h> | |
#include <stdlib.h> | |
/* Data structure used for marking. */ | |
typedef struct { | |
/* Size of the universe. */ | |
int size; | |
/* "Big" array, containing the entire universe. */ | |
int *array; |
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
#!/usr/bin/ruby | |
# Script to add a new user in the Zeus LDAP | |
require 'fileutils' | |
# Find a new user id | |
# | |
def find_new_user_id | |
id = 1200 | |
while not `getent passwd #{id}`.empty? do id = id + 1 end |
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 Formlets where | |
import Control.Applicative | |
import Control.Monad | |
import Control.Monad.Reader | |
import Control.Monad.State | |
import Control.Arrow (first) | |
import Data.Monoid | |
import Data.Either | |
import Data.Maybe |
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
-- | Proof-of-concept: use digestive functors for a command line interface | |
-- prompt | |
-- | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module IncrementalCli where | |
import Data.Map (Map) | |
import qualified Data.Map as M | |
import Data.Monoid (Monoid, mempty, mappend) | |
import Control.Applicative ((<$>), (<*>)) |
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
#!/usr/bin/lua | |
-------------------------------------------------------------------------------- | |
-- Distance implementation (abstract) -- | |
-------------------------------------------------------------------------------- | |
-- Simple minimum function for 3 arguments | |
local function min3(a, b, c) | |
local x = a < b and a or b | |
return x < c and x or c |
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
-- lz77.lua | |
module(..., package.seeall) | |
-- Length of the common prefix of str1 and str2 | |
function equal_characters(str1, str2) | |
-- Shortest length | |
local len | |
if string.len(str1) < string.len(str2) then | |
len = string.len(str1) | |
else |
OlderNewer