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
redo-ifchange env.sh && source env.sh | |
SRC=${1#"$BUILDDIR/"} | |
redo-ifchange "$SRC" # <- Mark the source (.cpp) dependency to Redo's database | |
$COMPILE -c "$SRC" -o "$3" $CXXFLAGS $INCLUDES -MMD -MF "$1.o.dep" | |
DEPS="" | |
while read -r line; do # Loop over all the header dependencies, and collect |
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
map contents in order: | |
- three: 3 | |
- one: 1 | |
- two: 2 | |
- four: 4 | |
map["three"]: 3 |
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
/path/to/nt2/build $ cmake .. -DCMAKE_C_COMPILER=gcc-4.6 -DCMAKE_CXX_COMPILER=g++-4.6 -DCMAKE_BUILD_TYPE=Release | |
-- [nt2] build type: Release (-O3 -DNDEBUG ) | |
-- [nt2] loading module arithmetic | |
-- [boost.simd.sdk] SIMD flag: -msse4.1 -mfpmath=sse | |
-- [boost.simd.sdk] target system: Mac OS X (Darwin 10.8.0) | |
-- [boost.simd.sdk] target processor: x86 (i386) | |
-- [boost.dispatch] Boost version: 1.47.0 | |
CMake Error at cmake/nt2.preprocess.cmake:27 (string): | |
string sub-command REGEX, mode REPLACE needs at least 6 arguments total to | |
command. |
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
Using built-in specs. | |
COLLECT_GCC=gcc-4.6 | |
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/4.6.0/gcc/libexec/gcc/x86_64-apple-darwin10.7.0/4.6.0/lto-wrapper | |
Target: x86_64-apple-darwin10.7.0 | |
Configured with: ../configure --enable-languages=c,c++,objc --prefix=/usr/local/Cellar/gcc/4.6.0/gcc --datarootdir=/usr/local/Cellar/gcc/4.6.0/share --bindir=/usr/local/Cellar/gcc/4.6.0/bin --program-suffix=-4.6 --with-gmp=/usr/local/Cellar/gmp/5.0.1 --with-mpfr=/usr/local/Cellar/mpfr/3.0.1 --with-mpc=/usr/local/Cellar/libmpc/0.9 --with-system-zlib --enable-stage1-checking --disable-lto --disable-nls | |
Thread model: posix | |
gcc version 4.6.0 (GCC) | |
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.6.8' '-v' '-fsyntax-only' '-mtune=core2' | |
/usr/local/Cellar/gcc/4.6.0/gcc/libexec/gcc/x86_64-apple-darwin10.7.0/4.6.0/cc1plus -quiet -v -D__DYNAMIC__ - -fPIC -quiet -dumpbase - -mmacosx-version-min=10.6.8 -mtune=core2 -auxbase - -version -fsyntax-only -o /dev/null | |
GNU C++ (GCC) version 4.6.0 (x86_64-apple-darwin10.7.0) |
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
/path/to/nt2/build $ cmake .. -DCMAKE_C_COMPILER=gcc-4.6 -DCMAKE_CXX_COMPILER=g++-4.6 -DCMAKE_BUILD_TYPE=Release | |
-- The C compiler identification is GNU | |
-- The CXX compiler identification is GNU | |
-- Checking whether C compiler has -isysroot | |
-- Checking whether C compiler has -isysroot - yes | |
-- Checking whether C compiler supports OSX deployment target flag | |
-- Checking whether C compiler supports OSX deployment target flag - yes | |
-- Check for working C compiler: /usr/local/bin/gcc-4.6 | |
-- Check for working C compiler: /usr/local/bin/gcc-4.6 -- works | |
-- Detecting C compiler ABI info |
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
def iterable(x): | |
"""Check whether x supports iteration""" | |
# originally implemented in NumPy, http://bit.ly/mSbVjo | |
try: iter(x) | |
except: return False | |
return True |
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
def mapping(x): | |
"""Check whether x is a mapping type (e.g. dict)""" | |
import sys | |
if 'numpy' in sys.modules: | |
try: | |
from numpy import ndarray | |
if isinstance(x, ndarray): return False # nasty special case | |
except ImportError: | |
pass | |
methods = ['__contains__', '__getitem__', 'items', 'iteritems'] |
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
def isstring(x): | |
"""Check whether x is a string (i.e. inherits basestring)""" | |
return isinstance(x, basestring) |
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
def prod(iterable): | |
"""Multiply elements of the iterable from left to right""" | |
import operator | |
end, it = object(), iter(iterable) | |
first = next(it, end) | |
return reduce(operator.mul, it, first) if first is not end else 1 |
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
def mean(iterable): | |
"""Find the mean value of the sequence (0 if empty). Consumes generators""" | |
if hasattr(iterable, '__len__'): | |
n = len(iterable) | |
return sum(iterable) / float(n) if n > 0 else 0.0 | |
else: | |
sentinel, iterable = object(), iter(iterable) | |
n, s = 1, next(iterable, sentinel) | |
if s is sentinel: return 0.0 | |
for x in iterable: n,s = n+1, s+x |