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
| -- | An RC4 implementation utilizing SBV. | |
| {-# LANGUAGE ScopedTypeVariables, MultiParamTypeClasses #-} | |
| module RC4 | |
| ( -- * Types | |
| S -- :: * | |
| , Key -- :: * | |
| , RC4 -- :: * | |
| -- * Swapping array values | |
| , swap -- :: SWord8 -> SWord8 -> S -> 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
| con meta t = { Label : string | |
| , Show : t -> string } | |
| fun mkTable [r ::: {Type}] (fl : folder r) (mr : $(map meta r)) (x : $r) = | |
| @fold [fn r => $(map meta r) -> $r -> string] | |
| (fn [nm :: Name] [t :: Type] [r :: {Type}] [[nm] ~ r] acc mr x => | |
| "<tr> <th>" ^ mr.nm.Label ^ "</th> <td>" | |
| ^ mr.nm.Show x.nm ^ "</td></tr>" | |
| ^ (acc (mr -- nm) (x -- nm))) | |
| (fn _ _ => "") fl mr x |
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
| con meta t = { Label : string | |
| , Show : t -> string } | |
| fun mkTable [r ::: {Type}] (fl : folder r) (mr : $(map meta r)) (x : $r) = | |
| @fold [fn r => $(map meta r) -> $r -> xtable] | |
| (fn [nm :: Name] [t :: Type] [r :: {Type}] [[nm] ~ r] acc mr x => | |
| <xml><tr><th>{[ mr.nm.Label ]}</th><td> | |
| {[ mr.nm.Show x.nm ]}</td></tr> | |
| { acc (mr -- nm) (x -- nm) } | |
| </xml>) |
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
| I have a perl script like this: | |
| $ cat foo.pl | |
| ... snip ... | |
| # these functions are exposed to users | |
| sub func1 { | |
| say "func1 arg: " . $_; | |
| ... | |
| } |
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
| 21:49:39 a@kratos ur-openid $ cat build.urpkg | |
| # -*- Perl -*- | |
| name 'openid'; | |
| version '0.0.0'; | |
| author 'Adam Chlipala <adam@chlipala.net>'; | |
| maintainer 'Adam Chlipala <adam@chlipala.net>'; | |
| license 'BSD3'; | |
| description 'OpenID authentication for Ur/Web'; | |
| homepage 'http://hg.impredicative.com/openid'; | |
| bug_tracker 'www.impredicative.com/mantis/'; |
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 ParallelArrays #-} | |
| {-# OPTIONS_GHC -fvectorise #-} | |
| module DotP (dotp_wrapper) where | |
| import qualified Prelude | |
| import Data.Array.Parallel | |
| import Data.Array.Parallel.Prelude.Int | |
| dotp_double :: [:Int:] -> [:Int:] -> Int |
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
| use std; | |
| import std::io; | |
| import std::uint; | |
| import std::task; | |
| import std::comm; | |
| type d = { ch: comm::chan<uint>, i: uint }; | |
| fn runner(c: d) { | |
| let z = c.i; // Satisfy move semantics for send |
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
| Q=@ | |
| E=@echo | |
| PANDOC=$(Q)pandoc | |
| FILES=$(shell ls *.md) | |
| FILES_HTML=$(patsubst %.md,outdir/%.html,$(FILES)) | |
| all: outdir $(FILES_HTML) | |
| outdir: | |
| $(Q)mkdir -p outdir |
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
| #if defined(COMPILER_GNUC) && \ | |
| (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) | |
| #define STATIC_ASSERT(cond,m) _Static_assert(cond, m) | |
| #else | |
| /* Not GCC 4.6 */ | |
| #define STATIC_ASSERT_NAME2(name, line) name ## line | |
| #define STATIC_ASSERT_NAME(line) STATIC_ASSERT_NAME2(jas_assert_, line) | |
| /* The unused 'm' is a transition into C1x _Static_assert */ | |
| #ifdef __COUNTER__ | |
| #define STATIC_ASSERT(cond,m) \ |
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 BangPatterns #-} | |
| import Crypto.NaCl.Encrypt.PublicKey | |
| import Crypto.NaCl.Nonce | |
| import Data.List | |
| import System.Environment | |
| main = do | |
| [f] <- getArgs | |
| let n = createZeroNonce nonceLength | |
| print n |