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 LambdaCase #-} | |
{-# LANGUAGE NumericUnderscores #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeApplications #-} | |
-- | | |
-- To reproduce with curl, run mainTls (from ghci) and use | |
-- | |
-- @ |
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 OverloadedStrings #-} | |
module Main where | |
import Data.IORef | |
import Data.Default | |
import qualified Network.HTTP.Types as Http | |
import qualified Network.Wai as Wai | |
import Network.Wai.Handler.Warp as Warp |
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 OverloadedStrings #-} | |
module Main where | |
import Control.Concurrent | |
import Control.Monad | |
import Data.ByteString hiding (putStrLn) | |
import Data.Default.Class | |
import Network.TLS | |
import Network.TLS.Extra.Cipher |
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 (main) where | |
import Control.Concurrent | |
main :: IO () | |
main = do | |
codechan <- newEmptyMVar | |
wait <- newEmptyMVar | |
myid <- myThreadId | |
putStrLn $ "I'm " ++ show myid |
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 BangPatterns #-} | |
-- % ghc -Wall -threaded -O A.hs | |
-- % ./A +RTS -N2 | |
-- | |
-- illegal hardware instruction | |
-- segmentation fault | |
module Main where | |
import Control.Concurrent |
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
Trying full handshake: | |
ClientHello --> | |
"010000e80303b90e92607bd3688f93ca0c05bc45253801a70c1b7d4d15e0919583594b3665b400003cc02bc02cc02fc030009e009fc023c024c027c0280067006bc009c00ac013c01400330039009c009d003d003c0035002f1301130200380032000a0005010000830000001d001b000018746c7331332e63727970746f2e6d6f7a696c6c612e6f7267ff01000100000a00060004001d0017000b00020100000d0012001008040805080604020503060304010201002b0003027f12002800260024001d0020252d54f0a5a7bfa3d61b904a616e2eed9dd091a0be6359ff44889610ddf49b44002d00020101" | |
"0200004e7f12e25d168388d7f371b510af05f0f1c55882cc14ef1e68fb97845b34271623ad991301002800280024001d00200b0870a2a19d080eaa56b5eda30e6e5978cffd5cd59afffa1bd6ea1cb6e66e26" | |
<-- ServerHello | |
"08000010000e000a00060004001d0017000000000b0009bc000009b800051830820514308203fca0030201020212031b91d311dd34af1b39e8a55d6f28eb45fb300d06092a864886f70d01010b0500304a310b300906035504061302555331163014060355040a130d4c6574277320456e6372797074312330210603550403131a4c6574277320456e637279707420417574686f72697479205833301e170d3137303 |
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 | |
import Control.Concurrent | |
main :: IO () | |
main = do | |
mvar <- newEmptyMVar | |
_ <- forkIO $ child mvar | |
action <- takeMVar mvar | |
action |
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
% ghc hello-world.hs -L/usr/lib -L/opt/local/lib | |
Linking hello-world ... | |
Undefined symbols for architecture x86_64: | |
"_PaUtil_AllocateMemory", referenced from: | |
_Pa_Initialize in libHSbindings-portaudio-0.0.1.a(pa_front.o) | |
"_PaUtil_FreeMemory", referenced from: | |
_Pa_Initialize in libHSbindings-portaudio-0.0.1.a(pa_front.o) | |
_Pa_Terminate in libHSbindings-portaudio-0.0.1.a(pa_front.o) | |
"_PaUtil_InitializeClock", referenced from: | |
_Pa_Initialize in libHSbindings-portaudio-0.0.1.a(pa_front.o) |
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 java.util.*; | |
class Person { | |
String name; | |
int age; | |
Person (String n, int a) { | |
name = n; | |
age = a; | |
} | |
} |
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
(defun which (file path) | |
(catch 'loop | |
(while path | |
(if (file-exists-p (expand-file-name file (car path))) | |
(throw 'loop (message "%s" (expand-file-name file (car path)))) | |
(setq path (cdr path)))))) |
NewerOlder