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 | |
# Pulseaudio volume control | |
class Pulse | |
attr_reader :volumes, :mutes | |
# Constructor | |
def initialize | |
dump = `pacmd dump`.lines | |
@volumes = {} |
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
/**************************************************************************** | |
* * | |
* Nite 1.3 - Players Sample * | |
* * | |
* Author: Oz Magal * | |
* * | |
****************************************************************************/ | |
/**************************************************************************** | |
* * |
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 Prelude hiding (reverse) | |
import Control.Arrow (first) | |
import Data.Set (Set) | |
import qualified Data.Set as S | |
import Data.Monoid (Monoid, mappend, mempty) | |
import Hakyll.Core.DirectedGraph | |
-- | This data structure represents the state of the dependency analyzer. It | |
-- holds a complete graph in 'analyzerGraph', which always contains all items, |
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 | |
-- Pattern matching a hex color, e.g. #fa74b3 | |
local hex_color = '#' .. string.rep('[0-9a-f]', 6) | |
-- Invert a hex color | |
function invert_hex_color(color) | |
-- Drop the initial '#' | |
color = string.sub(color, 2) | |
local inverted_color = '#' |
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
-- | This is a Haskell implementation of the benchmark published at: | |
-- | |
-- <http://www.ostinelli.net/a-comparison-between-misultin-mochiweb-cowboy-nodejs-and-tornadoweb/> | |
-- | |
-- It is pretty fast as well. It uses WAI and the Warp server. I didn't really | |
-- bother with using any web framework, since it's such a small benchmark. | |
-- | |
{-# LANGUAGE OverloadedStrings #-} | |
module Main 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
-- | A pure function that isn't. Or is it? | |
-- | |
eMach :: Double | |
eMach = eMach' 1.0 | |
where | |
eMach' i | |
| i' > 0 = eMach' i' | |
| otherwise = i | |
where | |
i' = i / 2.0 |
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 Ndfsm | |
( State (..) | |
, Transitions | |
, Ndfsm | |
, fromTransition | |
, fromTransitions | |
, fromAccepting | |
, fromStart | |
, lookupTransitions |
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 #-} | |
{-# OPTIONS_GHC -fno-warn-unused-do-bind #-} | |
import Hakyll | |
import Control.Arrow ((>>>)) | |
main :: IO () | |
main = hakyll $ do | |
-- Favicon | |
match "favicon.ico" copy |
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 Data.Monoid | |
import Data.Ord (comparing) | |
import Data.List (sortBy, maximumBy) | |
import Data.Map (Map) | |
import qualified Data.Map as M | |
-------------------------------------------------------------------------------- | |
-- We use a 'Castle' structure to represent the nodes, and a simple 'Graph' type |
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 ((<$>), (<*>), (<*)) | |
import Text.Parsec.Prim (many, skipMany) | |
import Text.Parsec.Combinator (choice, many1, manyTill, option) | |
import Text.Parsec.Char (alphaNum, anyChar, char, newline, spaces, string) | |
import Text.Parsec.String (Parser) | |
openMetadata :: Parser String | |
openMetadata = many1 (char '-') <* newline | |
metadataField :: Parser (String, String) |