This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
-- 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
-- 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-- | |
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |