Skip to content

Instantly share code, notes, and snippets.

@vvuk
vvuk / make-vs2017-env.bat
Created May 24, 2018 00:07
Generate "vcvarsall" equivalent for msys2 bash from vcvarsall
@ECHO OFF
set OLDPATH=%PATH%
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" x64 > NUL:
echo export INCLUDE='%INCLUDE%'
echo export LIB='%LIB%'
echo export LIBPATH='%LIBPATH%'
@zeux
zeux / crtheap.cpp
Created February 12, 2016 08:26
Overriding CRT heap functions to use a custom allocator.
// User-defined global heap prototypes
extern void mem_global_init();
extern void mem_global_term();
extern void* mem_global_allocate(size_t size, size_t align);
extern void mem_global_deallocate(void* ptr);
extern size_t mem_global_get_size(void* ptr);
// Actual code
#define BREAK() __debugbreak()
@aras-p
aras-p / preprocessor_fun.h
Last active June 2, 2025 18:02
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,