Skip to content

Instantly share code, notes, and snippets.

@mmozeiko
mmozeiko / etw_createfile.c
Last active March 14, 2024 00:14
Monitor which files are accessed with ETW
// this code will work only when compiled as 64-bit code, and on Windows 10
// older Windows version might require different structure definitions
#define NOMINMAX
#define INITGUID
#include <windows.h>
#include <evntrace.h>
#include <evntcons.h>
#pragma comment (lib, "shell32.lib")
@notnullnotvoid
notnullnotvoid / wc.cpp
Last active February 8, 2020 16:31
Optimizing simultaneous word and line counting for HMN
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
//NOTE: the correct behavior of this function is unfortunately not guaranteed by the standard
static char * read_entire_file(const char * filepath) {
FILE * f = fopen(filepath, "rb");
assert(f);
@d7samurai
d7samurai / .readme.md
Last active April 11, 2024 09:53
Minimal D3D11

Minimal D3D11

Minimal D3D11 reference implementation: An uncluttered Direct3D 11 setup + basic rendering primer and API familiarizer. Complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion that should be easy to follow from the code alone. ~200 LOC. No modern C++, OOP or (other) obscuring cruft. View on YouTube

hollowcube

Also check out Minimal D3D11 pt2, reconfigured for instanced rendering and with a smaller, tighter, simplified overall code structure, or Minimal D3D11 pt3, with shadowmapping + showcasing a range of alternative setup and rendering techniques.

@nickrolfe
nickrolfe / windows_modern_opengl_context.c
Last active April 24, 2024 13:00
Sample code showing how to create a window using a modern OpenGL core profile context without any libraries other than the standard Win32 wglXXX calls.
// Sample code showing how to create a modern OpenGL window and rendering context on Win32.
#include <windows.h>
#include <gl/gl.h>
#include <stdbool.h>
typedef HGLRC WINAPI wglCreateContextAttribsARB_type(HDC hdc, HGLRC hShareContext,
const int *attribList);
wglCreateContextAttribsARB_type *wglCreateContextAttribsARB;