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
-- | A simple webserver to store documents. Its primary goal is as a benchmark | |
-- for the Text library. | |
{-# LANGUAGE OverloadedStrings #-} | |
import Data.Char (isPunctuation) | |
import Data.List (foldl') | |
import Data.Monoid (mconcat) | |
import Control.Applicative ((<$>)) | |
import Control.Concurrent.MVar (MVar, modifyMVar_, newMVar, readMVar) | |
import Control.Monad.Reader (ReaderT, ask, runReaderT) |
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
# Read CSV files | |
v1 <- read.csv(file="s.csv", header=T) | |
v2 <- read.csv(file="rs.csv", header=T) | |
# Get result means | |
m1 <- v1$Mean | |
m2 <- v2$Mean | |
# Calculate procentual change | |
d <- (m2 - m1) * 100 / m1 |
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 | |
require 'tempfile' | |
if ARGV.length < 1 then | |
puts "Usage: #{$0} <criterion program> [output CSV file]" | |
puts "If not supplied, results.csv is used as default CSV filename" | |
exit 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
(* Fold over a file in chunks *) | |
let fold_file f x file_name = | |
let buffer = String.create 1024 in | |
let file = open_in file_name in | |
let rec go a = | |
let length = input file buffer 0 (String.length buffer) in | |
let a' = f a (String.sub buffer 0 length) in | |
if length > 0 then go a' else a' in | |
let r = go x in | |
close_in file; |
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 ExistentialQuantification, FlexibleInstances #-} | |
import Control.Monad.Reader (ReaderT, ask, runReaderT) | |
import Control.Monad.Trans (liftIO) | |
import System.Random (randomRIO) | |
-------------------------------------------------------------------------------- | |
data Message = Text String | Binary String | |
class Protocol p where |
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
# Map color names to actual values | |
SOLARIZED = { | |
:base03 => '#002b36', # brblack | |
:base02 => '#073642', # black | |
:base01 => '#586e75', # brgreen | |
:base00 => '#657b83', # bryellow | |
:base0 => '#839496', # brblue | |
:base1 => '#93a1a1', # brcyan | |
:base2 => '#eee8d5', # white | |
:base3 => '#fdf6e3', # brwhite |
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 Control.Applicative ((<$>)) | |
type Code = [Char] | |
universe :: [Code] | |
universe = universe' (4 :: Int) | |
where | |
universe' 0 = [[]] | |
universe' n = [x : xs | x <- ['0' .. '9'], xs <- universe' (n - 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
{-# LANGUAGE OverloadedStrings #-} | |
import Control.Applicative ((<$>)) | |
import Control.Arrow ((>>>)) | |
import Data.Monoid (mempty) | |
import System.FilePath (takeBaseName) | |
import System.Posix (getFileStatus, fileSize) | |
import qualified Data.Map as M | |
import Hakyll |
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 | |
# This script reads your monitor settings using the `xrandr` tool. It selects a | |
# random wallpaper for each monitor from a specified directory. A large image is | |
# created to fit all monitors, which can then be set using any tool. | |
require 'RMagick' | |
class Screen | |
attr_reader :name, :width, :height, :offset_x, :offset_y |
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
REPLAY,1334685038,00:21:91:F1:EA:0A,00:01:E3:A7:FE:B0,-87.0 | |
REPLAY,1334685056,00:21:91:F1:EA:0A,00:01:E3:A7:FE:B0,-85.0 | |
REPLAY,1334685061,00:21:91:F1:EA:0A,00:01:E3:A7:FE:B0,-88.0 | |
REPLAY,1334685076,00:21:91:F1:EA:0A,00:01:E3:A7:FE:B0,-89.0 | |
REPLAY,1334685146,00:21:91:F1:EA:0A,00:01:E3:A7:FE:B0,-86.0 | |
REPLAY,1334685151,00:21:91:F1:EA:0A,00:01:E3:A7:FE:B0,-87.0 | |
REPLAY,1334685338,00:21:91:F1:EA:0A,00:01:E3:A7:FE:B0,-88.0 | |
REPLAY,1334685366,00:21:91:F1:EA:0A,00:01:E3:A7:FE:B0,-88.0 | |
REPLAY,1334685486,00:21:91:F1:EA:0A,00:01:E3:A7:FE:B0,-89.0 | |
REPLAY,1334685550,00:21:91:F1:EA:0A,00:01:E3:A7:FE:B0,-88.0 |