Skip to content

Instantly share code, notes, and snippets.

@ErikAugust
ErikAugust / spectre.c
Last active August 2, 2024 01:59
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@h4tr3d
h4tr3d / qtc-display-all-project-files.md
Last active January 21, 2020 14:49
Qt Creator: show all project files in stocked CMake plugin in Hackers way

Not a question, just a life-hack :-)

Changes, that allows showing all project files in project view is discarded. Clarification that Project View is not a Project View but Build System View is added to the documentation. So, now there is no way to propagate CMakeProjectManager2 changes to the upstream at all.

But we can still display all files using stock plugin and existing functionality. Just hack it using fake CMAKE_TOOLCHAIN_FILE...

Idea:

  • using file(GLOB_RECURSE ...) scan project tree for files
@snipsnipsnip
snipsnipsnip / rwgetc.c
Last active May 11, 2022 00:17
int rwgetc(SDL_RWops *rw)
/* fgetc equivalent for SDL_rwops */
int rwgetc(SDL_RWops *rw)
{
char c;
return SDL_RWread(rw, &c, 1, 1) == 1 ? c : EOF;
}
/* fgets equivalent for SDL_rwops */