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
| 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(); | |
| task(); | |
| std::chrono::duration<float> dt(std::chrono::system_clock::now() - start); | |
| return dt.count(); | |
| } |
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
| enum class lambda_state {DELETE,EXECUTE,PAUSED,DIRECT,ASYNC}; | |
| template<typename T> class method; | |
| template <typename Res, typename... Args> class method<Res(Args...)> | |
| { | |
| public: | |
| 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 |
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
| 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...)> | |
| { | |
| public: | |
| using F = std::function<R(A...)>; | |
| using P = std::tuple<A...>; |
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
| 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 |
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
| class FrameBuffer | |
| { | |
| private: | |
| uint bufferID = 0; | |
| uint depthID = 0; | |
| uint textureID = 0; | |
| bool depth = false; | |
| uint width = 0; | |
| uint height = 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
| 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; |
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
| #!/bin/bash | |
| VERSION="3.0" | |
| ERR_COLOR="\033[31m" | |
| NFO_COLOR="\033[32m" | |
| WRN_COLOR="\033[33m" | |
| SCRIPT_NAME=`basename $0` | |
| ARCH=$(uname -i) | |
| NAME=$(lsb_release -si) |
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
| @echo Install package manager ... | |
| @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\ProgramData\chocolatey\bin | |
| @choco install Far | |
| @choco install Console2 | |
| @choco install python2 | |
| @choco install pip | |
| @choco install cmake |
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
| 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 | |
| args[i](function(...) | |
| if(#{...})==1 then |
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
| #!/bin/bash | |
| VERSION="5.0 (ubuntu 14.04 x86_64 LTS)" | |
| ERR_COLOR="\033[31m" | |
| WRN_COLOR="\033[33m" | |
| NFO_COLOR="\033[32m" | |
| SCRIPT_NAME=`basename $0` | |
| ARCH=$(uname -i) |
OlderNewer