Uses DirectWrite and D2D to render Segoe UI Emojis
This file contains hidden or 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
| // | |
| // Build with: | |
| // > clang -fobjc-arc triangle.m -o triangle -framework Metal -framework AppKit -framework QuartzCore | |
| // | |
| #import <Cocoa/Cocoa.h> | |
| #import <Metal/Metal.h> | |
| #import <QuartzCore/QuartzCore.h> | |
| typedef struct { | |
| float position[2]; |
This file contains hidden or 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
| int main() { | |
| char *path = "/path/to/my/directory"; | |
| print("watching %s for changes...\n", path); | |
| HANDLE file = CreateFile(path, | |
| FILE_LIST_DIRECTORY, | |
| FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, | |
| NULL, | |
| OPEN_EXISTING, | |
| FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, |
This file contains hidden or 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
| // | |
| // Build with: | |
| // > clang coreaudio_backend.m -o main -framework AudioUnit | |
| // | |
| // | |
| // Base Types | |
| // | |
| #include <stdint.h> |
This file contains hidden or 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
| // | |
| // Compile with: | |
| // > cl /I . /D"BUILD_DEBUG=1" /D"BUILD_ARCH64=1" /D"BUILD_WIN=1" /Z7 /W4 /sdl /MT /GR- /EHa /WX /nologo /Oi /Gm- /MP d3d12_textured_quad.c /link /opt:ref /DEBUG "kernel32.lib" "user32.lib" "gdi32.lib" "d3d12.lib" "dxguid.lib" "dxgi.lib" "d3dcompiler.lib" /OUT:d3d12_textured_quad.exe | |
| // | |
| #pragma warning(disable:4221) | |
| #pragma warning(disable:4204) | |
| #pragma warning(disable:4201) | |
| #define NOMINMAX |
This file contains hidden or 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
| // | |
| // Converts Google Keep exported JSON notes to Obsidian markdown files | |
| // Usage: node keep2obsidian.js | |
| // Place files in a sibling directory called: `notes` | |
| // | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const readJSON = (filePath) => { |
This file contains hidden or 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
| // | |
| // NOTE(nick): modified version of spall.h to make it a single-file header library | |
| // | |
| // Usage: | |
| #if 0 | |
| // 1) Include this in your C source: | |
| #include "spall.h" | |
| // 2) Call the setup functions: | |
| int main() { |
This file contains hidden or 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
| // | |
| // NOTE(nick): | |
| // | |
| // 1. Get Dawn: | |
| // | |
| // on Windows get a prebuilt copy of dawn from: https://github.com/mmozeiko/build-dawn | |
| // | |
| // on MacOS build from source with: | |
| // git clone https://github.com/google/dawn | |
| // cd dawn |
If you do C programming on Windows you need cl.exe in your PATH.
Unfortunately, running the batch file to locate the cl.exe compiler (vcvarsall.bat) takes about ~5 seconds!
That's only a problem on new Command Prompt sessions, but if you use a program that kicks off a build step it's really annoying to have to run this before any of your build commands.
But, thankfully, there's a way around this. We can create a script to inflate the same environment variables that vcvarsall.bat ultimately sets up.
As a side-effect, this is also how to have a single file to manage all of your Command Prompt environment variables in Windows.
This file contains hidden or 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
| // Types | |
| #define NULL 0 | |
| typedef unsigned char u8; | |
| typedef unsigned int u32; | |
| typedef signed int i32; | |
| typedef signed long long i64; | |
| typedef double f64; | |
| // Imports |
NewerOlder
