Skip to content

Instantly share code, notes, and snippets.


Alexey Gnetko kreed131

View GitHub Profile
View ParseLgl.hs
main = do
html <- getUrl ""
getThreadLinks html
getUrl url = snd <$> curlGetString url curlOpts
getThreadLinks s = do
xs <- runX $ (parseHtml s) >>> css "a" >>> getAttrValue "href"
return $ map ((++) ourUrl2) . extractEvery 3 $ filter (\y -> isInfixOf "threads/" y && isInfixOf "page" y && (not . isInfixOf "http") y) xs
kreed131 / C8Client2.hs
Created Jul 22, 2011
Simple TCP client on Haskell
View C8Client2.hs
import Network.Socket hiding (send, sendTo, recv, recvFrom)
import Network.Socket.ByteString (send, recv)
import qualified Data.ByteString.Char8 as B8
import System.Environment (getArgs)
kreed131 / SimpleTCPServer.hs
Created Jul 22, 2011
Simple TCP Server on Haskell
View SimpleTCPServer.hs
import Network.Socket hiding (send, recv)
import Network.Socket.ByteString
import Control.Concurrent (forkIO)
import qualified Data.ByteString.Char8 as B8
import System.Environment (getArgs)
View ShootMe.hs
Depends on scrot.
shootMe <directory to save images> <period>
ghc -o shootMe ShootMe.hs;
shootMe /home/user/images/screenshots/auto/ 60 &
import Control.Concurrent (threadDelay)
import System (system, getArgs)
kreed131 / BotvaBot.hs
Created Jun 17, 2011
Bot for browser mmorpg written in Haskell
View BotvaBot.hs
import Prelude hiding (catch)
import Data.Char (isDigit)
import Data.Maybe (fromMaybe)
import qualified Data.Map as M (lookup)
import System.IO
import System.Random (randomRIO)
kreed131 / SnakeHS.hs
Created Jun 17, 2011
SnakeHS - OpenGL Snake game on Haskell
View SnakeHS.hs
import Graphics.UI.GLUT
import Data.IORef
import Data.List (delete)
import System.Random (randomRIO)
import Control.Monad (forM_, when)
type Coord = (Int, Int)
type Snake = (Direction, [Coord])
type SnakeDigestion = [Coord]
type Food = [Coord]