Skip to content

Instantly share code, notes, and snippets.

/* Example of a library interposer: interpose on malloc().
* gcc -D_GNU_SOURCE -fPIC -O2 -Wall -o malloc_interposer.so -shared malloc_interposer.c -ldl
* setenv LD_PRELOAD $cwd/malloc_interposer.so
* run the app
*/
#include <stdio.h>
#include <dlfcn.h>
#include <string.h>
# Makefile!
SOURCES := $(sort $(wildcard src/*.cpp src/*.cu src/*.cc src/*.c))
OBJECTS := $(sort $(patsubst src/%, obj/%.o, $(SOURCES)))
DEPENDS := $(sort $(patsubst src/%, obj/%.d, $(SOURCES)))
CFLAGS +=
CUFLAGS +=
CPPFLAGS +=
LDFLAGS +=
#include <string>
#include <boost/spirit/home/qi.hpp>
#include <boost/spirit/home/lex.hpp>
#include <boost/spirit/home/lex/lexer/lexertl/lexer.hpp>
struct dtype {
dtype() {}
dtype(std::string const & value) {}
};
[11:59pm][wlynch@fallston ~/test] ipython
Python 2.4.3 (#1, Sep 21 2011, 19:55:41)
Type "copyright", "credits" or "license" for more information.
IPython 0.8.4 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
[4:16am][wlynch@fallston ~/test] cat package/module.py
#!/usr/bin/env python
print "Loading module.py"
from package import signal
[4:18am][wlynch@fallston ~/test] python package/module.py
Loading module.py
Traceback (most recent call last):
File "package/module.py", line 3, in ?
from package import signal
ImportError: No module named package
@sharth
sharth / gist:2997272
Created June 26, 2012 17:31
Valgrind fails to build
[12:26pm][wlynch@watermelon ~] brew install valgrind
==> Downloading http://valgrind.org/downloads/valgrind-3.7.0.tar.bz2
Already downloaded: /Library/Caches/Homebrew/valgrind-3.7.0.tar.bz2
==> ./configure --prefix=/Users/wlynch/Homebrew/Cellar/valgrind/3.7.0 --mandir=/Users/wlynch/Homebrew/Cellar/valgrind/3.7.0/share/man --enable-only64bit --build=amd64-darwin
==> make
echo "# This is a generated file, composed of the following suppression rules:" > default.supp
echo "# " exp-sgcheck.supp xfree-3.supp xfree-4.supp darwin10-drd.supp darwin11.supp >> default.supp
cat exp-sgcheck.supp xfree-3.supp xfree-4.supp darwin10-drd.supp darwin11.supp >> default.supp
make all-recursive
Making all in include
class X {
public:
X() {
this->val = rand();
}
int val;
};
static X global_value;
class X {
public:
X() {
this->val = rand();
}
int val;
};
static X global_value;
#include <utility>
int main() {
std::pair<int, volatile long> x(3, 4);
}
using namespace std;
#include<iostream>
#include<cmath>
#include<iomanip>
void readit(int);
void calcit(int, float, int, int);
int writeit(float, float, float, float, int, int);
int GetNumber(string Give) {