Skip to content

Instantly share code, notes, and snippets.


Martin Sugioarto nakal

View GitHub Profile
nakal / PamTest.hs
Created Jan 14, 2015
PAM authentication test in Haskell
View PamTest.hs
import System.Posix.PAM
main = do
res <- authenticate "system" "user" "pass"
case res of
Left a -> putStrLn $ "error: " ++ pamCodeToMessage a
Right () -> putStrLn "success"
nakal / Lockpattern.hs
Created Dec 8, 2014
Generate a random 3x3 unlock pattern for Android devices
View Lockpattern.hs
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 / tcpserver.hs
Last active Aug 29, 2015
Threaded TCP-Server in Haskell (IPv4/IPv6)
View tcpserver.hs
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