Skip to content

Instantly share code, notes, and snippets.

@t-mat
t-mat / 00compile_lz4mt
Last active December 15, 2015 08:09
lz4mt : OS independent, multithreading, block based lz4 compress/decompressor in C++11.
# 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
@roxlu
roxlu / VideoSurface.cpp
Created January 29, 2013 11:25
Fast texture uploads using pixel buffer objects. Improved upload of a 768x1366 texture from 16-20ms to 1-3ms (we can improve the performance a bit more by using GPU default pixel formats)
#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)
@justgord
justgord / scoped_timer.cpp
Created January 8, 2013 09:26
C++11 scoped timer class and usage
// 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
//
@dzhou
dzhou / prime_math.py
Created May 8, 2012 03:37
fast prime/factorization mathematics in python
#!/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
@hacst
hacst / playingwithchrono.cpp
Created March 17, 2012 09:12
Cross-platform, high-resolution time measurement using C++11's std::chrono
#include <iostream>
#include <chrono>
#include <thread>
using namespace std;
using namespace chrono;
int main()
{
cout << "Measurement resolution: " <<
@bcse
bcse / build-ffmpeg.sh
Created August 22, 2011 17:01
Compile FFmpeg/Libav for iOS
# 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' \