Skip to content

Instantly share code, notes, and snippets.

Kirill A. Shabordin donkaban

Block or report user

Report or block donkaban

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View trace call time
template <typename callable, typename ... arguments>
static float trace(callable && f, arguments &&... args)
std::function<typename std::result_of<callable(arguments...)>::type()>
task(std::bind(std::forward<callable>(f), std::forward<arguments>(args)...));
std::chrono::time_point<std::chrono::system_clock> start = std::chrono::system_clock::now();
std::chrono::duration<float> dt(std::chrono::system_clock::now() - start);
return dt.count();
View gist:20ebe3bedf74cfa55ff6
enum class lambda_state {DELETE,EXECUTE,PAUSED,DIRECT,ASYNC};
template<typename T> class method;
template <typename Res, typename... Args> class method<Res(Args...)>
using F = std::function<Res(Args...)>; // functor
using R = typename std::result_of<F(Args...)>::type; // result type
using L = std::function<void(R)>; // result lambda
View gist:601bc99a5e84bc9e493d
template<int...> struct seq {};
template<int N, int ...M> struct gen : gen<N-1, N-1, M...> { };
template<int ...N> struct gen<0, N...> {typedef seq<N...> type;};
template <typename T> class method;
template <typename R, typename... A> class method<R(A...)>
using F = std::function<R(A...)>;
using P = std::tuple<A...>;
def track_field_changes(only=None, exclude=()):
Django models decorator for tracking fields changes
:only: fields to track for changes (all otherwise)
:exclude: fields to exclude from tracking
Adds to model instance:
get_old_value(field_name) — old value of given field
is_changed(field_name=None) — is any field (or given field) is changed
View gist:c7fed0f3eb922cab3736
class FrameBuffer
uint bufferID = 0;
uint depthID = 0;
uint textureID = 0;
bool depth = false;
uint width = 0;
uint height = 0;
View gist:662b23a33b6e62c4a20a
namespace interpolate
template<typename T> T linear(const T &v0,const T &v1,float t)
return v0 + (v1 - v0) * t;
template<typename T> T cosine(const T& v0, const T& v1, float t)
auto t2 = (1.0 - cos(t * PI)) / 2.0;
donkaban /
Last active Aug 29, 2015
debian toolset installer
SCRIPT_NAME=`basename $0`
ARCH=$(uname -i)
NAME=$(lsb_release -si)
@echo Install package manager ...
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString(''))" && SET PATH=%PATH%;%systemdrive%\ProgramData\chocolatey\bin
@choco install Far
@choco install Console2
@choco install python2
@choco install pip
@choco install cmake
View gist:727a174139591ceb65ae
function collect(...)
local args = {...}
local numArgs = #args
local lambda = args[numArgs]
local result = {}
local finisher = 1
if(numArgs < 2) then Log.error("[QP] You must have minimum 2 params in collect()") return end
for i=1,numArgs-1 do
if(#{...})==1 then
View gist:1213849a8b5eb1fbb02c
VERSION="5.0 (ubuntu 14.04 x86_64 LTS)"
SCRIPT_NAME=`basename $0`
ARCH=$(uname -i)
You can’t perform that action at this time.