This file contains hidden or 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 Control.Error (runEitherT, left) | |
import Control.Monad (foldM) | |
import Control.Monad.Identity (runIdentity) | |
import qualified Data.Map.Strict as Map | |
type NFSM = Map.Map (Int, Char) [Int] | |
edges :: NFSM | |
edges = Map.fromList | |
[ ((1, 'a'), [2, 3]) |
This file contains hidden or 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
-- http://apple.stackexchange.com/questions/36943/how-do-i-automate-a-key-press-in-applescript | |
tell application "System Events" | |
key down control | |
key code 124 | |
key code 124 | |
key up control | |
end tell |
This file contains hidden or 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
/* | |
* Run with | |
* gcc -o cipher cipher.c -lcrypto | |
* ./cipher | |
*/ | |
#include <string.h> | |
#include <openssl/evp.h> | |
int main() |
This file contains hidden or 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 OverloadedStrings #-} | |
module Main where | |
import Control.Monad | |
import qualified Data.ByteString.Char8 as C | |
import Data.Default | |
import Network.TLS | |
import Network.TLS.Extra (ciphersuite_medium) | |
import Network.Xmpp |
This file contains hidden or 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 ScopedTypeVariables #-} | |
import Codec.Binary.UTF8.String (decodeString) | |
import Control.Concurrent | |
import Control.Monad | |
import qualified Data.ByteString.Char8 as C8 | |
import qualified Data.Map as Map | |
import Data.Maybe (fromJust) | |
import qualified Graphics.UI.Threepenny as UI | |
import Graphics.UI.Threepenny.Core |
This file contains hidden or 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 System.IO | |
import System.IO.Unsafe (unsafePerformIO) | |
import System.Process | |
import Control.Concurrent | |
mhin = unsafePerformIO newEmptyMVar | |
mhout = unsafePerformIO newEmptyMVar | |
ended = unsafePerformIO newEmptyMVar | |
main = do |
This file contains hidden or 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
-- Section "9.2.3 Object Storage" in <<Pro Git>> | |
-- The original example was written in ruby. | |
import Codec.Zlib | |
import qualified Crypto.Hash.SHA1 as SHA1 | |
import qualified Data.ByteString.Char8 as C | |
import qualified Data.ByteString as B | |
import Data.Char | |
import System.Directory |
This file contains hidden or 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 OverloadedStrings #-} | |
import Control.Monad.Trans.Resource (ResourceT) | |
import Filesystem.Path.CurrentOS (decodeString) | |
import Network.HTTP.Types (status200) | |
import Network.Wai (responseLBS, rawPathInfo, Request, Response) | |
import Network.Wai.Handler.Warp (run) | |
import Network.Wai.Application.Static (staticApp, defaultFileServerSettings) | |
import Network.Wai.Middleware.Vhost (vhost) | |
import qualified Data.ByteString as S |
This file contains hidden or 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 DeriveDataTypeable #-} | |
import Network.HTTP | |
import Text.JSON | |
import Text.JSON.Generic | |
import System.Cmd | |
import GHC.IO.Exception | |
-- there are two types of json response: song & ad. | |
-- the 'company', 'rating_avg', 'public_time', 'ssid' fields are missing in ad_json |
This file contains hidden or 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
-- Using Yesod (AForm) to build a simple web interface to Pandoc | |
-- THIS is simply a demonstration, much can be done to improve it. | |
{-# LANGUAGE QuasiQuotes, TemplateHaskell, MultiParamTypeClasses, | |
OverloadedStrings, TypeFamilies #-} | |
import Yesod | |
import Data.Text (Text, unpack, pack) | |
import Text.Pandoc | |
import Control.Applicative ((<$>), (<*>)) | |
data Yespandoc = Yespandoc |
NewerOlder