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
#!/usr/bin/python | |
import socket | |
import sys | |
# Create a TCP/IP socket | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
# Connect the socket to the port where the server is listening | |
server_address = ('localhost', 10000) |
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
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
module Main where | |
import Control.Monad.Trans | |
import Control.Monad.Free.Class | |
import qualified Control.Monad.Trans.Free as FT | |
import qualified Control.Monad.Free as F |
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
-- 3 | |
fmap fmap fmap | |
= fmap . fmap | |
-- 4 | |
fmap fmap fmap fmap | |
= (fmap . fmap) fmap | |
= fmap (fmap fmap) | |
-- 5 |
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
module Main where | |
-- | Get octant points for a circle of given radius. | |
octant :: (Num a, Ord a) => a -> [(a, a)] | |
octant r = takeWhile inOctant . map fst $ iterate step ((r, 0), 1 - r) | |
where | |
-- check if we are still in octant | |
inOctant (x, y) = x >= y | |
-- go to the next point in the circle |
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
<!-- GetShopTV Analytics --> | |
<script> | |
(function(t,e,n,s,a,c,i){t.GetShopTVAnalyticsObject=a,t[a]=t[a]||function(){ | |
(t[a].q=t[a].q||[]).push(arguments)},t[a].l=1*new Date,c=e.createElement(n), | |
i=e.getElementsByTagName(n)[0],c.async=1,c.src=s,i.parentNode.insertBefore(c,i) | |
})(window,document,"script","//api.getshop.tv/static/analytics.js","gst"); | |
</script> | |
<!-- END GetShopTV Analytics --> | |
<!-- Manually trigger GetShopTV events wherever applicable --> |
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
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE RecordWildCards #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} |
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
module BinarySearch where | |
import Data.Vector.Unboxed (Vector, (!), Unbox) | |
import qualified Data.Vector.Unboxed as Vector | |
-- | Binary search in a Vector. | |
binary :: (Ord a, Unbox a) => a -> Vector a -> Int | |
binary x xs = binary' 0 (Vector.length xs - 1) | |
where | |
binary' a b |
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
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
module Control.Monad.Declare.Lazy where | |
import Control.Monad | |
import Control.Monad.Trans | |
import Data.Functor.Identity | |
import Data.Monoid |
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
{-# LANGUAGE TemplateHaskell, Rank2Types #-} | |
module Main where | |
import Prelude hiding (last) | |
import Control.Lens | |
import Control.Monad.State.Strict (StateT, evalStateT, put) | |
import Control.Monad.IO.Class (liftIO) | |
import Control.Monad (when) | |
import Control.Applicative ((<$>), (<*>), pure) |
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
{-# LANGUAGE TypeFamilies, ExistentialQuantification, FlexibleInstances #-} | |
module Main where | |
import System.IO (isEOF, hFlush, stdout) | |
import Data.Char (toLower, isDigit) | |
import Data.Maybe (isNothing) | |
import Control.Monad.Trans.Free | |
import Control.Monad.IO.Class (MonadIO, liftIO) |
OlderNewer