This file contains 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
#pragma once | |
inline float repeat(float v, float min, float max) | |
{ | |
v -= min; | |
v *= 1.0f / (max - min); | |
v -= (float)(int)(v); | |
v += 1.0f; | |
v -= (float)(int)(v); |
This file contains 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
#include <cstdlib> | |
#include <ctime> | |
template<typename Head, typename... Tail> | |
constexpr int count_template_parameter(const Head &) { | |
return 1; | |
} | |
template<typename Head, typename... Tail> | |
constexpr int count_template_parameter(const Head &, const Tail & ...tail) { |
This file contains 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
#include <Windows.h> | |
#include <iostream> | |
#include <conio.h> // _getch | |
#pragma comment(lib, "winmm.lib") | |
HMIDIOUT omidi; | |
HMIDIIN imidi; | |
void CALLBACK MidiInProc(HMIDIIN hMidiIn, UINT wMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2) |
This file contains 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
-- helper function for buttons state | |
-- call btn_update ONCE per update | |
-- btnd returns true once the button is pressed down | |
-- btnu returns true when the button is released | |
do | |
local state = {0,0,0,0,0,0} | |
-- call this in _update! | |
btn_update=function () | |
for b=0,6 do |
This file contains 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
//from https://pastebin.com/3YvWQa5c | |
#define CONCAT_INTERNAL(x,y) x##y | |
#define CONCAT(x,y) CONCAT_INTERNAL(x,y) | |
template<typename T> | |
struct ExitScope { | |
T lambda; | |
ExitScope(T lambda):lambda(lambda){} | |
~ExitScope(){lambda();} |
This file contains 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
constexpr bool constStringEquals(const char * lhs, const char * rhs) { | |
return (*lhs) != (*rhs) | |
? false | |
: ((*lhs) == 0 | |
? true | |
: constStringEquals(lhs + 1, rhs + 1) | |
); | |
} | |
constexpr bool constStringEndsWith(const char * str, const char * suffix) { |
This file contains 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 OFF | |
setlocal ENABLEDELAYEDEXPANSION | |
SET /a x=0 | |
FOR /R H:\ %%G IN (*.cda) DO (CALL :SUB_VLC "%%G") | |
GOTO :eof | |
:SUB_VLC |
This file contains 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
// ==UserScript== | |
// @name youtube mini ad block | |
// @namespace Violentmonkey Scripts | |
// @grant none | |
// @include https://www.youtube.com/* | |
// ==/UserScript== | |
var started = false; | |
var adWholeTime = 0; |
This file contains 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 () { | |
var links = document.getElementsByTagName("a") | |
var regex = /imgur.com.*gif$/ig | |
for(var i = 0; i != links.length; ++i) { | |
var href = links[i].href; | |
if(regex.test(href)) | |
{ | |
links[i].setAttribute('href', href + "v"); | |
console.log(href) |
This file contains 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
/* | |
* Coroutines. | |
* | |
* To make a (fake) coroutine we use these macros. A coroutine method must be static, | |
* return bool and needs a parameter (Generator & generator). | |
* | |
* Generator must follow this schema: | |
* struct Generator { | |
* int line; | |
* float time; |
NewerOlder