Skip to content

Instantly share code, notes, and snippets.

damienzhang

Block or report user

Report or block damienzhang

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@damienzhang
damienzhang / numberplay.hs
Created Mar 14, 2018
Code for damienzhang.com/numberplay
View numberplay.hs
import Data.List
import Text.Printf
choose :: Int -> [a] -> [[a]]
choose 0 _ = [[]]
choose _ [] = []
choose n (x:xs) = map (x :) (choose (n - 1) xs) ++ choose n xs
perm :: Int -> [a] -> [[a]]
perm n = concatMap permutations . choose n
View twentyeighteen.hs
module Main where
import Control.Monad
import Data.List (foldl')
data Operator
= Add
| Sub
| Mult
| Div
@damienzhang
damienzhang / hdf5build.sh
Last active Dec 25, 2015
Build the HDF5 library using local install of GCC and G++ with C++ library enabled.
View hdf5build.sh
CC='/sim/dev/sdz/tools/bin/gcc' \
CXX='/sim/dev/sdz/tools/bin/g++' \
./configure --prefix=/sim/dev/sdz/tools --enable-cxx
@damienzhang
damienzhang / gccbuild.sh
Last active Dec 22, 2015
How to build a local copy of GCC 4.7.3 (just C and C++) This is built without support for graphite loop optimizations.
View gccbuild.sh
wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.7.3/gcc-4.7.3.tar.bz2
tar xjf gcc-4.7.3.tar.bz2
cd gcc-4.7.3
./contrib/download_prerequisites
cd ..
mkdir build
cd build
export PREFIX=/sim/dev/sdz/tools
You can’t perform that action at this time.