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 Arrows #-} | |
import Control.Wire | |
import Prelude hiding ((.), id) | |
import System.Console.ANSI | |
import Data.Maybe | |
import Control.Arrow | |
import Control.Monad.Trans.State | |
import Control.Monad.Trans | |
import Data.Time.Clock |
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 GADTs, DataKinds, KindSignatures #-} | |
import Data.Word | |
import Data.Int | |
import Numeric | |
import Data.Bits | |
import Data.Binary.Put (putWord32le, putWord16le, runPut) | |
import Data.ByteString.Lazy (unpack) | |
import qualified Data.ByteString as 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 OverloadedStrings, ScopedTypeVariables #-} | |
import qualified Data.ByteString as BS | |
import qualified Data.ByteString.Char8 as C8 | |
import qualified System.IO.Streams.Combinators as SC | |
import Network.Socket (withSocketsDo) | |
import System.IO.Streams (InputStream, OutputStream, ReadTooShortException) | |
import Network.Http.Client | |
import qualified System.IO.Streams as S | |
import Data.Maybe | |
import Control.Exception (bracket) |
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 ScopedTypeVariables #-} | |
import System.USB | |
import Control.Monad (forM_, when) | |
import Data.Vector (toList, Vector) | |
import Control.Exception | |
import Text.PrettyPrint | |
import Control.Arrow hiding ((<+>)) | |
import qualified Data.ByteString as BS | |
import Numeric |
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
# the system. Help is available in the configuration.nix(5) man page | |
# or the NixOS manual available on virtual console 8 (Alt+F8). | |
{ config, pkgs, ... }: | |
{ | |
require = | |
[ # Include the results of the hardware scan. | |
./hardware-configuration.nix | |
]; |
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 qualified Data.ByteString.Char8 as B | |
import Criterion.Main | |
import Data.IORef | |
import Data.Vector | |
import Data.ByteString.Char8 (ByteString) | |
import Control.Monad (forever) | |
import Pipes | |
import qualified Pipes.Prelude as P | |
import Data.Char (intToDigit) | |
import qualified Data.ByteString.Builder as Builder |
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 System.USB | |
( InterfaceDesc(interfaceEndpoints, interfaceNumber), | |
EndpointDesc(endpointAddress), | |
DeviceDesc(deviceProductId, deviceVendorId), | |
Device, | |
Ctx, | |
ConfigDesc(configInterfaces), | |
withDeviceHandle, | |
withDetachedKernelDriver, | |
withClaimedInterface, |
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 Images where | |
import Data.ByteString ( ByteString(..) ) | |
import qualified Data.ByteString as BS | |
import qualified Data.ByteString.Unsafe as BSU | |
import Graphics.UI.GLUT | |
import qualified Graphics.Rendering.OpenGL.GL as GL | |
import qualified Codec.BMP as BMP | |
import Foreign.ForeignPtr | |
import Foreign.Ptr |
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 Data.Char | |
import Data.Map (Map) | |
import qualified Data.Map as Map | |
entropy :: (Ord a) => [a] -> Float | |
entropy dta = | |
let freqmap = Map.fromListWith (+) $ zip dta (repeat 1) | |
modifier = 1.0 / fromIntegral (length dta) | |
freqs = Map.map (\v -> fromIntegral v * modifier) freqmap |
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/env nix-build | |
{ pkgs ? import (builtins.fetchTarball https://github.com/NixOS/nixpkgs/archive/2fa9bd50597c3089cc00abb3f20d7510fcc8ad6a.tar.gz) { } | |
}: | |
let | |
inherit (pkgs) stdenv lib; | |
theoremDistrib = pkgs.fetchurl { | |
url = https://download.microsoft.com/download/D/1/D/D1D6FCF9-4D04-49FE-9952-0D295B180CF4/4ct.msi; | |
sha256 = null; | |
}; | |
theoremSrc = stdenv.mkDerivation { |