Skip to content

Instantly share code, notes, and snippets.

#include <poly/Log.h>
#include <OpenCvBackgroundSubtraction.h>
namespace poly {
OpenCvBackgroundSubtraction::OpenCvBackgroundSubtraction()
:subtractor(NULL)
,width(0)
,height(0)
{
@roxlu
roxlu / focus.bar
Created October 6, 2016 15:09
Script to focus application (Windows 10 shows taskbar when application starts) (source: http://stackoverflow.com/questions/8266840/focus-a-batch-started-application)
:start
call :focus "Title of Window"
timeout /t 10 /nobreak > NUL
goto start
::exit /b
:focus
setlocal EnableDelayedExpansion
if ["%~1"] equ [""] (
@roxlu
roxlu / RendezVousClient.cpp
Created May 25, 2016 19:34
STUN + RendezVous Server / Cliet
#include <poly/Log.h>
#include <RendezVousClient.h>
#include <RendezVousTypes.h>
namespace poly {
/* -------------------------------------------------------------- */
RendezVousClientSettings::RendezVousClientSettings()
:rv_port(0)
@roxlu
roxlu / CMakeLists.txt
Created May 13, 2016 09:26
CMakeLists for microprofile; for now it compiles the demo_ui. Tested on Mac and Win.
cmake_minimum_required(VERSION 2.8)
project(microprofile)
include(ExternalProject)
set(bd ${CMAKE_CURRENT_LIST_DIR})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# SDL
ExternalProject_Add(
#!/bin/sh
set -x
if [ ! -d ${PWD}/h264 ] ; then
mkdir h264
fi
if [ ! -d ${PWD}/r264 ] ; then
mkdir r264
fi
@roxlu
roxlu / AudioConverterBrain.cpp
Created May 6, 2016 20:05
Example implementation of using the amazing b8brain audio samplerate converter, https://github.com/avaneev/r8brain-free-src This was used for a real time audio stream converter.
#include <poly/AudioConverterBrain.h>
#include <poly/AudioDataConverter.h>
namespace poly {
AudioConverterBrain::AudioConverterBrain()
:listener(NULL)
{
}
#if 0
/* takes ~0.038ms */
for (size_t k = 0; k < convert_from.nchannels; ++k) {
std::vector<double>& prepared_data = channel_data[k];
for (size_t i = 0; i < nframes; i++) {
prepared_data[i] = src_ptr[k + (i * convert_from.nchannels)];
}
}
#else
/* takes 0.0025 ms*/
@roxlu
roxlu / CMakeLists.txt
Created April 8, 2016 12:07
mkdir build
cmake_minimum_required(VERSION 2.8)
project(PluginTest)
add_library(Transportation STATIC Car.cpp SomeFunctions.c)
add_library(Plugin MODULE Plugin.cpp)
target_link_libraries(Plugin Transportation)
@roxlu
roxlu / TestFboChangeBuffer.cpp
Last active September 11, 2020 15:48
Comparing the performance of different ping/pong techniques when using FBOs. One version uses two fbos and swaps between these, the other switches the draw and read buffer. See these results https://docs.google.com/spreadsheets/d/1ZyTQGkjYQajQtu8OvgRyaXJl46F4rZJStBCEK2kebgE/edit?usp=sharing for a comparison. It seems that switching read / draw b…
#include <poly/Log.h>
#include <TestFboChangeBuffer.h>
using namespace poly;
TestFboChangeBuffer::TestFboChangeBuffer()
:fbo(0)
,dx(0)
{
tex[0] = 0;
@roxlu
roxlu / fun.cpp
Last active January 5, 2021 08:52 — forked from kizzx2/fun.cpp
Using lua 5.2 with C++
// fun.cpp
// This is for Lua 5.2, for Lua 5.1, see https://gist.github.com/kizzx2/1594905
#include <lua.hpp>
#include <iostream>
#include <sstream>
class Foo
{