Skip to content

Instantly share code, notes, and snippets.

@bagobor
bagobor / retro.py
Created January 17, 2014 08:03 — forked from benwebber/retro.py
#!/usr/bin/env python
"""
An 8-bit avatar generator.
"""
from __future__ import division
import argparse
import hashlib
#!/bin/bash
echo Building Google Protobuf for Mac OS X / iOS.
echo Use 'tail -f build.log' to monitor progress.
(
PREFIX=`pwd`/protobuf
mkdir ${PREFIX}
mkdir ${PREFIX}/platform
2b19acb1ac85c20eb4d648619b7c5a9f9a6eef22
GoblinDefenders/Classes/Arena.cpp | 10 +-
GoblinDefenders/Classes/ArenaInfo.h | 1 +
GoblinDefenders/Classes/GameTypedef.h | 4 +-
GoblinDefenders/Classes/Helper.cpp | 9 +
GoblinDefenders/Classes/Helper.h | 3 +
GoblinDefenders/Classes/Item.cpp | 41 ++
GoblinDefenders/Classes/Item.h | 10 +
GoblinDefenders/Classes/JSONDataManager.cpp | 8 +
GoblinDefenders/Classes/Market.cpp | 30 +-
HIDDevice - Opened
...............................................................................|
...............................................................................\
...............................................................................-
...............................................................................|
...............................................................................|
...............................................................................\
................................................................................
................................................................................
................................................................................
@bagobor
bagobor / gist:0eec2c3cbf1e444ecf66
Created May 28, 2015 09:56
9DOF Sensor Fusion Code Sample
// Implementation of Sebastian Madgwick's "...efficient orientation filter for... inertial/magnetic sensor arrays"
// (see http://www.x-io.co.uk/category/open-source/ for examples and more details)
// which fuses acceleration, rotation rate, and magnetic moments to produce a quaternion-based estimate of absolute
// device orientation -- which can be converted to yaw, pitch, and roll. Useful for stabilizing quadcopters, etc.
// The performance of the orientation filter is at least as good as conventional Kalman-based filtering algorithms
// but is much less computationally intensive---it can be performed on a 3.3 V Pro Mini operating at 8 MHz!
void MadgwickQuaternionUpdate(float ax, float ay, float az, float gx, float gy, float gz, float mx, float my, float mz)
{
float q1 = q[0], q2 = q[1], q3 = q[2], q4 = q[3]; // short name local variable for readability
@bagobor
bagobor / gist:d4b2bc1384cea95ed52a
Created June 14, 2015 00:07
Value/ID Handle class C++11 way
#include <algorithm>
#include <utility>
#include <iostream>
#include <memory>
struct Handle {
Handle (int val) : m_handl((int*)(void*)val, EmptyDeleter) { }
Handle(Handle&& src) : m_handl(std::move(src.m_handl)) {}
Handle(const Handle& that) = delete;
@bagobor
bagobor / selene_test.cpp
Last active September 3, 2015 08:20
[visual studio 2015]Selene error
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
struct SimpleVec2
{
float x, y;
@bagobor
bagobor / chaiscript_test.cpp
Last active September 3, 2015 09:30
chaiscript test
#include <chaiscript/chaiscript.hpp>
#include <chaiscript/chaiscript_stdlib.hpp>
bool test(int* data) {
int &i = *data;
i = i + 2;
return true;
}
int _tmain(int argc, _TCHAR* argv[])
@bagobor
bagobor / build.log
Created September 9, 2015 12:31
lua-api-pp b build errors
1>------ Build started: Project: libluapp, Configuration: Debug Win32 ------
1> impl.cpp
1>d:\dev\github\lua-api-pp\luapp\lua_operations.hxx(118): error C2977: 'lua::_::Lazy': too many template arguments
1> d:\dev\github\lua-api-pp\luapp\lua_lazy.hxx(61): note: see declaration of 'lua::_::Lazy'
1> d:\dev\github\lua-api-pp\luapp\lua_operations.hxx(193): note: see reference to class template instantiation 'lua::_::lazyConcat<VT11,VT12>' being compiled
1>d:\dev\github\lua-api-pp\luapp\lua_operations.hxx(206): error C2977: 'lua::_::Lazy': too many template arguments
1> d:\dev\github\lua-api-pp\luapp\lua_lazy.hxx(61): note: see declaration of 'lua::_::Lazy'
1> d:\dev\github\lua-api-pp\luapp\lua_operations.hxx(272): note: see reference to class template instantiation 'lua::_::lazyArithmetics<T1,T2,op>' being compiled
1>d:\dev\github\lua-api-pp\luapp\lua_valueset.hxx(380): error C2572: 'lua::Valset::Valset': redefinition of default argument: parameter 1
1> d:\dev\github\lua-api-pp\luapp\lua_valueset.hxx(376):
@bagobor
bagobor / gist:4e1e0c47f6f6f014b5d5
Created November 13, 2015 07:34 — forked from Madsy/gist:6980061
Working multi-threading two-context OpenGL example with GLFW 3.0.3 and GLEW 1.8
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <vector>
#include <cmath>
#include <cstdio>
#include <limits>
#include <chrono>
#include <thread>
#include <mutex>