This file contains hidden or 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
# check your g++ version | |
g++ --version | |
# --> g++ version 4.6.3 (or greater) | |
# compile | |
gcc -c -std=c99 lz4.c | |
gcc -c -std=c99 lz4hc.c | |
g++ -c -std=c++0x lz4mt.cpp | |
g++ -c -std=c++0x main.cpp | |
g++ -o lz4mt lz4.o lz4hc.o main.o -lpthread |
This file contains hidden or 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
#include <shared/VideoSurface.h> | |
GLuint VideoSurface::prog = 0; | |
GLint VideoSurface::u_pm = 0; | |
GLint VideoSurface::u_mm = 0; | |
GLint VideoSurface::u_tex = 0; | |
GLfloat VideoSurface::pm[16] = {0}; | |
VideoSurface::VideoSurface() | |
:width(0) |
This file contains hidden or 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
// C++11 scoped timer class and usage | |
// | |
// an example of RAII 'resource acquisition is initialisation' idiom | |
// build : g++ -Wall -std=c++11 -O5 -o scoped_timer scoped_timer.cpp | |
// | |
// on linux x64 resolution of timer seems to be microseconds [ on win/VC it may be much worse ] | |
// | |
// I like this approach as it doesnt litter your existing code with garbage, | |
// although there might be some inaccuracy due to stack setup/pulldown of the timer class itself | |
// |
This file contains hidden or 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 | |
# | |
# Kefei Dan Zhou | |
# | |
import math | |
# return a dict or a list of primes up to N | |
# create full prime sieve for N=10^6 in 1 sec |
This file contains hidden or 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
#include <iostream> | |
#include <chrono> | |
#include <thread> | |
using namespace std; | |
using namespace chrono; | |
int main() | |
{ | |
cout << "Measurement resolution: " << |
This file contains hidden or 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
# configure for armv7 build | |
./configure \ | |
--cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \ | |
--as='/usr/local/bin/gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' \ | |
--sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk \ | |
--target-os=darwin \ | |
--arch=arm \ | |
--cpu=cortex-a8 \ | |
--extra-cflags='-arch armv7' \ | |
--extra-ldflags='-arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk' \ |
NewerOlder