Skip to content

Instantly share code, notes, and snippets.

@mmozeiko
mmozeiko / etw_createfile.c
Last active October 12, 2024 23:26
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 December 6, 2024 11:27
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 part 2, reconfigured for instanced rendering and with a smaller, tighter, simplified overall code structure, or Minimal D3D11 part 3, with shadowmapping + showcasing a range of alternative setup and rendering techniques.

@nickrolfe
nickrolfe / windows_modern_opengl_context.c
Last active December 2, 2024 04:40
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;