Skip to content

Instantly share code, notes, and snippets.

View marcmo's full-sized avatar

Oliver Mueller marcmo

View GitHub Profile
newtype SpecialChar = SC { unSC :: Char } deriving Show
instance Arbitrary SpecialChar where
arbitrary = do
x <- oneof [choose ('\0','\55295'), choose ('\57344','\1114111')]
return (SC x)
class BuildingBlock
attr_accessor :name, :base
attr_reader :config, :dependencies
def initialize(config, name)
@name = name
@dependencies = []
@config = config
ALL_BUILDING_BLOCKS[@name] = self
end
# # usage
# require 'cxxproject'
#
# cxx_configuration "Test" do
# exe "bla", :source => FileList[*.arxml]
# lib "lib1", :source => "xxx/azzz/"
# end
CxxConfigs = []
@marcmo
marcmo / echoServer.hs
Created March 23, 2011 08:00
simple haskell program for sending over socket and receiving a response with a timeout
-- Echo server program
module Main where
import Control.Monad (unless,when)
import Network.Socket hiding (recv)
import qualified Data.ByteString as S
import Data.Word(Word8)
import Control.Concurrent(threadDelay)
import Data.List
import Numeric
@marcmo
marcmo / LuaIntegration.hs
Created April 4, 2011 11:10
support for interpretation of a lua file
module LuaIntegration where
import qualified Scripting.Lua as Lua
lua_noerrors = 0
lua_yield = 1
lua_errrun = 2
lua_errsyntax = 3
lua_errmem = 4
@marcmo
marcmo / app.js
Created April 26, 2011 15:41
doesn't work with the async stuff in line 23
var http = require('http'),
util = require('util'),
formidable = require('formidable'),
server;
global.TEST_PORT = 13532;
server = http.createServer(function(req, res) {
if (req.url == '/') {
res.writeHead(200, {'content-type': 'text/html'});
@marcmo
marcmo / includeChecker.hs
Last active September 28, 2015 04:48
check for include paths in C/C++ files that contain wrongly cased characters change: only analyze ascii characters
{-# LANGUAGE OverloadedStrings #-}
import System.FilePath.FindCompat
import System.FilePath.Posix
import Control.Exception
import qualified Data.ByteString as BS
import qualified Data.Map as M
import Control.Applicative
import qualified Data.ByteString.Char8 as BSC
import Text.Regex
import Data.Maybe(isJust)
@marcmo
marcmo / simple.hs
Created July 21, 2012 14:14
simple hakyll site that escapes urls
{-# LANGUAGE OverloadedStrings, Arrows #-}
module Main where
import Prelude hiding (id)
import Data.Monoid(mempty)
import qualified Data.Map as M
import Control.Category (id)
import Control.Arrow((&&&),arr,(>>>),(>>^))
import Hakyll
@marcmo
marcmo / VoltageFFI.hs
Created October 10, 2012 12:48
using quickcheck to simulate voltage curves
{-# LANGUAGE ForeignFunctionInterface #-}
module VoltageFFI
(
voltageStateC
,addListenerC
,normal_voltage
,voltageChangeC
,c_timeoutEvent
,c_tearDown
)
import Data.List(foldl')
data Operator = Plus | Minus | Div | Mult | None | Id Double deriving(Eq,Show)
operators = [Plus,Minus,Div,Mult,None]
higher :: Operator -> Operator -> Bool
higher None None = False
higher None _ = True
higher Div Plus = True
higher Div Minus = True