Skip to content

Instantly share code, notes, and snippets.

Alexey Gnetko kreed131

Block or report user

Report or block kreed131

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ParseLgl.hs
main = do
html <- getUrl "http://asd.com"
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
kreed131 / C8Client2.hs
Created Jul 22, 2011
Simple TCP client on Haskell
View C8Client2.hs
---
-- kreed131.blogspot.com/2011/07/tcp.html
---
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
kreed131 / SimpleTCPServer.hs
Created Jul 22, 2011
Simple TCP Server on Haskell
View SimpleTCPServer.hs
---
-- kreed131.blogspot.com/2011/07/tcp-haskell-networksocket.html
---
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>
Using:
ghc -o shootMe ShootMe.hs;
shootMe /home/user/images/screenshots/auto/ 60 &
-}
import Control.Concurrent (threadDelay)
import System (system, getArgs)
@kreed131
kreed131 / BotvaBot.hs
Created Jun 17, 2011
Bot for browser mmorpg botva.ru written in Haskell
View BotvaBot.hs
{--
kreed131.blogspot.com
--}
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
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]
You can’t perform that action at this time.