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
[gui] | |
fontui = -family 微软雅黑Monaco -size 8 -weight normal -slant roman -underline 0 -overstrike 0 | |
fontdiff = -family \"YaHei Consolas Hybrid\" -size 8 -weight normal -slant roman -underline 0 -overstrike 0 | |
encoding = utf-8 | |
warndetachedcommit = true | |
tabsize = 4 | |
recentrepo = D:/Open/foundationdb-haskell | |
[user] | |
email = sighingnow@gmail.com | |
name = HE, Tao |
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 Control.Monad.ST | |
import System.IO.Unsafe | |
import Unsafe.Coerce | |
unsafePerformST :: ST s a -> a | |
unsafePerformST m = unsafePerformIO $ | |
stToIO $ -- unsafely do it | |
unsafeCoerce m -- convert to ST Realworld a | |
{-# NOINLINE unsafePerformST #-} |
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 #-} | |
import Criterion.Main | |
import Weigh | |
numericEnumFromThen :: (Fractional a) => a -> a -> [a] | |
numericEnumFromThen n m = n `seq` m `seq` (n : numericEnumFromThen m (m+m-n)) | |
numericEnumFromThenTo :: (Ord a, Fractional a) => a -> a -> a -> [a] | |
numericEnumFromThenTo e1 e2 e3 |
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
D:\Open>gcc test.c -Wall -c | |
test.c: In function 'g': | |
test.c:8:14: warning: passing argument 1 of 'f' from incompatible pointer type [-Wincompatible-pointer-types] | |
return f(cp); | |
^~ | |
test.c:1:5: note: expected 'int *' but argument is of type 'char *' | |
int f(int *a) { | |
^ | |
D:\Open>stack exec -- ghc -c test.c -Wall |
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
"""Simple example on how to log scalars and images to tensorboard without tensor ops. | |
License: Copyleft | |
""" | |
__author__ = "Michael Gygli, Tao He" | |
import tensorflow as tf | |
try: | |
from StringIO import StringIO | |
except: |
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
concatMap :: (Foldable f, Monoid (f b)) => (a -> f b) -> f a -> f b | |
concatMap = foldMap | |
filter :: (Applicative f, Foldable f, Monoid (f a)) => | |
(a -> Bool) -> f a -> f a | |
filter p = foldMap (\a -> if p a then pure a else mempty) |
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
all: libacpp.dll app.exe | |
GHC := stack ghc -- | |
%.o: %.cpp | |
$(CXX) -c $< -o $@ | |
libacpp.dll: acpp.o acpp_capi.o | |
$(CXX) $^ -shared -o $@ # On Linux/Unix, -fPIC is needed. |
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 TypeOperators #-} | |
module T where | |
-- | Infix application. | |
-- | |
-- @ | |
-- f :: IO $ Maybe Int | |
-- = |
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
# This file contains default non-project-specific settings for 'stack', used | |
# in all projects. For more information about stack's configuration, see | |
# http://docs.haskellstack.org/en/stable/yaml_configuration.html | |
# | |
# {} | |
package-indices: | |
- require-hashes: false | |
gpg-verify: false | |
name: TUNA |
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 python | |
# -*- coding: utf-8 -*- | |
def get_cpu_number(): | |
''' Return the processors' number, an integer value. | |
''' | |
import os | |
return int(os.environ['NUMBER_OF_PROCESSORS']) |