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
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 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
Main.mapM_Unpack (f :: Word8 -> m ()) (PS payload rb1_a1Tf offset length) -> | |
let { | |
>> :: m () -> m () -> m () | |
>> = GHC.Base.>> @ m $dMonad_a1E5 @ () @ () } | |
in | |
letrec { | |
loop :: Addr# -> Int# -> m () -> GHC.Prim.State# GHC.Prim.RealWorld -> (# GHC.Prim.State# GHC.Prim.RealWorld, m () #) | |
loop addr index default_m world -> | |
case index of | |
(-1) -> (# world, default_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
Main.mapM_IndexReverse = (f :: GHC.Word.Word8 -> m ()) (PS payload rb1_a1UY offset length) -> | |
let return :: m () | |
return = GHC.Base.return @ m $dMonad_a1Dq @ () GHC.Tuple.() | |
>> :: m () -> m () -> m () | |
>> = GHC.Base.>> @ m $dMonad_a1Dq @ () @ () | |
in | |
letrec { | |
loop :: Int# -> m () | |
loop index -> | |
case index of |
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 MultiWayIf, BangPatterns #-} | |
import Data.Word | |
import Data.Char | |
data Tape = Tape { negatives :: [Word8], currentTape :: !Word8, positives :: [Word8] } | |
mkTape = Tape (repeat 0) 0 (repeat 0) | |
shiftLeft (Tape (x:left) curr right) = Tape left x (curr:right) | |
shiftRight (Tape left curr (x:right)) = Tape (curr:left) x right |
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
module OpenGLUtils where | |
import Data.ByteString ( ByteString(..) ) | |
import qualified Data.ByteString as BS | |
import qualified Data.ByteString.Unsafe as BSU | |
import Graphics.UI.GLUT | |
import Graphics.Rendering.OpenGL (($=)) | |
import qualified Graphics.Rendering.OpenGL as GL | |
import qualified Codec.BMP as BMP | |
import Foreign.ForeignPtr |
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
{ | |
module AlexMonadicTemplate (main) where | |
} | |
%wrapper "monad" | |
tokens :- | |
<0> . { mkL LDummy } | |
<0> $white ; | |
{ |
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
#!/bin/bash | |
function curlMingw { | |
local address="$1" | |
perl -e "use LWP::UserAgent;" -e "my \$ua = LWP::UserAgent->new;" -e "my \$req = HTTP::Request->new(GET => \"$address\");" -e "my \$resp = \$ua->request(\$req);" -e "print \$resp->decoded_content;" | |
} |
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
qscintilla-qt4 = stdenv.mkDerivation rec { | |
name = "qscintilla-qt4-${version}"; | |
version = pkgs.qscintilla.version; | |
disabled = isPy3k || isPyPy; | |
src = pkgs.qscintilla.src; | |
buildInputs = [ pkgs.python ]; | |
propagatedBuildInputs = [ pkgs.pyqt4 pkgs.qscintilla pkgs.qt4 ]; |
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
#include <iostream> | |
#include <string> | |
#include <utility> | |
#include <conio.h> | |
#include <chrono> | |
#include <thread> | |
#include "react/Domain.h" | |
#include "react/Event.h" | |
#include "react/Observer.h" |
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 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 |