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 |
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) |
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) |
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) |
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] |