Skip to content

Instantly share code, notes, and snippets.

@npezolano
npezolano / .ghci file
Created November 13, 2013 04:35
.ghci file
:set prompt "λ: "
:set -fno-warn-unused-imports
:def hlint const . return $ ":! hlint \"src\""
:def hoogle \s -> return $ ":! hoogle --count=15 \"" ++ s ++ "\""
:def pl \s -> return $ ":! pointfree \"" ++ s ++ "\""
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8; -*-
//
// Simple example showing how expose a C++ function
//
// Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
#include <RInside.h> // for the embedded R via RInside
// a c++ function we wish to expose to R
const char* hello( std::string who ){
## -*- mode: make; tab-width: 8; -*-
##
## Simple Makefile
##
## From RInside examples
## TODO:
## proper configure for non-Debian file locations, [ Done ]
## allow RHOME to be set for non-default R etc
## comment this out if you need a different version of R,
# unregister broken GHC packages. Run this a few times to resolve
# dependency rot in installed packages. ghc-pkg-clean -f
# cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
do
echo unregistering $p; ghc-pkg $* unregister $p
done
}
@npezolano
npezolano / makeR
Last active December 17, 2015 11:59
compile R on mac osx with gcc ,clang and accelerate framework
#make R with GCC
./configure CC="gcc-mp-4.7 -arch x86_64" CXX="gcc-mp-4.7 -arch x86_64" F77="gfortran-mp-4.7 -arch x86_64" FC="gfortran-mp-4.7 -arch x86_64" OBJC="gcc-mp-4.7 -arch x86_64" --x-includes=/usr/X11/include/ --x-libraries=/usr/X11/lib/ --with-blas='-framework Accelerate' --with-lapack --without-aqua CPPFLAGS="-D__ACCELERATE__" --prefix=/Users/admin1/lib/R --enable-BLAS-shlib
#make R with Clang
./configure CC="clang -arch x86_64" CXX="clang -arch x86_64" F77="gfortran -arch x86_64" FC="gfortran -arch x86_64" OBJC="clang -arch x86_64" --x-includes=/usr/X11/include/ --x-libraries=/usr/X11/lib/ --with-blas='-framework Accelerate' --with-lapack --without-aqua CPPFLAGS="-D__ACCELERATE__" --prefix=/Users/admin1/libclang34 --enable-BLAS-shlib
#!/bin/bash
# source: http://www.haskell.org/pipermail/haskell-cafe/2011-March/090170.html
sudo rm -rf /Library/Frameworks/GHC.framework
sudo rm -rf /Library/Frameworks/HaskellPlatform.framework
sudo rm -rf /Library/Haskell
rm -rf .cabal
rm -rf .ghc
rm -rf ~/Library/Haskell
@npezolano
npezolano / gist:5515846
Last active December 16, 2015 23:39
HPX on mac osx gcc 4.7.3 Git: bdb5d1e5a194bc0994184dfcb50d0f27ea68fb51
DYLD_LIBRARY_PATH=/Users/admin1/libgcc47/downloads/boost_1_53_0/stage/lib/:/Users/admin1/libgcc47/downloads/hpx/install/lib/hpx/ ./bin/fibonacci --n-value 20 --hpx:threads 4
@npezolano
npezolano / gist:5477576
Last active March 7, 2024 06:46
Changing the thread name on C++11
#include <thread>
#include <iostream>
#include <pthread.h>
using namespace std;
void foo()
{
string s = "thread1";
char name[16];
@npezolano
npezolano / build_gcc_4.7.2_on_mac.sh
Last active October 13, 2015 16:17 — forked from doubleotoo/build_gcc_4.7_on_mac.sh
Script to download and build gcc 4.7 and its dependencies on mac - it took about 40 minutes on my machine (and the "make check" in the gcc build failed for lack of an "autogen" script"), but the compiler seems to work.
#!/bin/sh
# warning may need updating
# You might want to modify the first line to specify your own install location.
# In theory the rest should not need tweaking...
export GCC_PREFIX="$HOME/gcc4.7"
# Hopefully, you can tweak these as they get out of date, but the download URL's
# may not be stable to text substitution.
GMP_DOWNLOAD_VERSION=gmp-5.0.5
MPFR_DOWNLOAD_VERSION=mpfr-3.1.1