Skip to content

Instantly share code, notes, and snippets.

View AndreasVoellmy's full-sized avatar

Andreas Voellmy AndreasVoellmy

View GitHub Profile
@AndreasVoellmy
AndreasVoellmy / SimpleServer.hs
Created December 1, 2012 19:50
Tiny test web server
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP, ForeignFunctionInterface #-}
-- ghc --make -O2 -funbox-strict-fields -threaded -rtsopts SimpleServer.hs
import Network.Socket
import System.Environment (getArgs)
import Control.Monad
import Foreign
import Foreign.C.Types
@AndreasVoellmy
AndreasVoellmy / epoll-example-pipe.c
Created October 16, 2012 17:30
epoll_ctl with EPOLLET on an already readable file
// compile with: gcc epoll-example-pipe.c
#include <stdio.h>
#include <stdlib.h>
#include <sys/epoll.h>
#define MAXEVENTS 64
int
main (int argc, char *argv[])