Skip to content

Instantly share code, notes, and snippets.

View nakal's full-sized avatar

Martin Sugioarto nakal

View GitHub Profile
@nakal
nakal / PamTest.hs
Created January 14, 2015 22:45
PAM authentication test in Haskell
import System.Posix.PAM
main = do
res <- authenticate "system" "user" "pass"
case res of
Left a -> putStrLn $ "error: " ++ pamCodeToMessage a
Right () -> putStrLn "success"
@nakal
nakal / Lockpattern.hs
Created December 8, 2014 22:40
Generate a random 3x3 unlock pattern for Android devices
{-
File: Lockpattern.hs
This programm calculates a pattern for the 3x3 lock screen in Android
devices. It outputs the path in form of a matrix with numbered
finger positions.
-}
import System.Random
@nakal
nakal / tcpserver.hs
Last active August 29, 2015 14:00
Threaded TCP-Server in Haskell (IPv4/IPv6)
import Network.Socket as N
import Control.Concurrent
serverPort :: PortNumber
serverPort = 8080
main = do
sock <- N.socket N.AF_INET6 N.Stream N.defaultProtocol
N.setSocketOption sock N.ReuseAddr 1
N.setSocketOption sock N.ReusePort 1