Skip to content

Instantly share code, notes, and snippets.

💭
QUIC and TLS 1.3

Kazu Yamamoto kazu-yamamoto

💭
QUIC and TLS 1.3
Block or report user

Report or block kazu-yamamoto

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kazu-yamamoto
kazu-yamamoto / gist:cde22cf569e7e78a179d30a9982b1433
Last active Oct 7, 2017
Concurrent hello world in Haskell
View gist:cde22cf569e7e78a179d30a9982b1433
module Main (main) where
import Control.Concurrent
main :: IO ()
main = do
codechan <- newEmptyMVar
wait <- newEmptyMVar
myid <- myThreadId
putStrLn $ "I'm " ++ show myid
View gist:25b7b4ee7884e30a93355e20f5efe0ac
{-# LANGUAGE BangPatterns #-}
-- % ghc -Wall -threaded -O A.hs
-- % ./A +RTS -N2
--
-- illegal hardware instruction
-- segmentation fault
module Main where
import Control.Concurrent
@kazu-yamamoto
kazu-yamamoto / gist:4a647ffc38adf0ab56f26165a2a9c02b
Last active Jan 31, 2017
TLS 1.3 PSK failure from Haskell to NSS
View gist:4a647ffc38adf0ab56f26165a2a9c02b
Trying full handshake:
ClientHello -->
"010000e80303b90e92607bd3688f93ca0c05bc45253801a70c1b7d4d15e0919583594b3665b400003cc02bc02cc02fc030009e009fc023c024c027c0280067006bc009c00ac013c01400330039009c009d003d003c0035002f1301130200380032000a0005010000830000001d001b000018746c7331332e63727970746f2e6d6f7a696c6c612e6f7267ff01000100000a00060004001d0017000b00020100000d0012001008040805080604020503060304010201002b0003027f12002800260024001d0020252d54f0a5a7bfa3d61b904a616e2eed9dd091a0be6359ff44889610ddf49b44002d00020101"
"0200004e7f12e25d168388d7f371b510af05f0f1c55882cc14ef1e68fb97845b34271623ad991301002800280024001d00200b0870a2a19d080eaa56b5eda30e6e5978cffd5cd59afffa1bd6ea1cb6e66e26"
<-- ServerHello
"08000010000e000a00060004001d0017000000000b0009bc000009b800051830820514308203fca0030201020212031b91d311dd34af1b39e8a55d6f28eb45fb300d06092a864886f70d01010b0500304a310b300906035504061302555331163014060355040a130d4c6574277320456e6372797074312330210603550403131a4c6574277320456e637279707420417574686f72697479205833301e170d3137303
@kazu-yamamoto
kazu-yamamoto / gist:9428e2512fb91f06010ad0f0f36def27
Last active Jun 24, 2016
concurrent hello world in Haskell
View gist:9428e2512fb91f06010ad0f0f36def27
module Main where
import Control.Concurrent
main :: IO ()
main = do
mvar <- newEmptyMVar
_ <- forkIO $ child mvar
action <- takeMVar mvar
action
View gist:a6947c34aa19bde299df
% 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)
View gist:db10dd7600653109b57a
import java.util.*;
class Person {
String name;
int age;
Person (String n, int a) {
name = n;
age = a;
}
}
View gist:11270834
(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))))))
@kazu-yamamoto
kazu-yamamoto / gist:9266343
Created Feb 28, 2014
errno is Haskell thread local
View gist:9266343
{-# LANGUAGE ForeignFunctionInterface #-}
import Control.Concurrent
import Foreign.C.Types
import Foreign.C.Error
main :: IO ()
main = do
s <- c_socket 2 1 0
forkIO $ do
View gist:8951304
{-# LANGUAGE DeriveDataTypeable, RankNTypes #-}
-- FIXME: should we replace Data with System?
module Data.AutoUpdate where
import Control.Applicative ((<$>))
import Data.IORef
import Control.Concurrent (threadDelay, forkIOWithUnmask)
import Control.Monad (forever, void)
import Control.Exception (Exception, SomeException(..), handle, catches, throwIO, assert, Handler(..), mask)
import Data.Typeable (Typeable)
View gist:8949722
{-# LANGUAGE DeriveDataTypeable #-}
-- FIXME: should we replace Data with System?
module Data.AutoUpdate where
import Control.Applicative ((<$>))
import Data.IORef
import Control.Concurrent (threadDelay, forkIO, ThreadId, myThreadId)
import Control.Monad (forever)
import Control.Exception (throwTo, Exception, handle, fromException, throwIO, assert, SomeException)
import Data.Typeable (Typeable)
You can’t perform that action at this time.