This file contains 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
#include <stdio.h> | |
#define STR2(x) #x | |
#define STR(x) STR2(x) | |
#ifdef _WIN32 | |
#define INCBIN_SECTION ".rdata, \"dr\"" | |
#else | |
#define INCBIN_SECTION ".rodata" | |
#endif |
This file contains 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
// download glfw3 from https://www.glfw.org/download and then compile: | |
// cl.exe -O2 q1.c -Iinclude -link opengl32.lib glu32.lib lib-vc2019\glfw3dll.lib | |
#define _CRT_SECURE_NO_DEPRECATE | |
#include <stdint.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <math.h> | |
#include <assert.h> |
This file contains 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
/* ======================================================================== | |
$File: tools/ctime/ctime.c $ | |
$Date: 2016/05/08 04:16:55PM $ | |
$Revision: 7 $ | |
$Creator: Casey Muratori $ | |
$Notice: | |
The author of this software MAKES NO WARRANTY as to the RELIABILITY, | |
SUITABILITY, or USABILITY of this software. USE IT AT YOUR OWN RISK. |
This file contains 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
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
THIS IS BAD WAY TO USE WASAPI. DO NOT USE MAYBE EXCEPT AS REFERENCE TO WASAPI FUNCTIONS. | |
/* ======================================================================== | |
$File: $ | |
$Date: $ | |
$Revision: $ |
This file contains 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
#include <windows.h> | |
#include <intrin.h> | |
#define Assert(x) do { if (!(x)) __debugbreak(); } while (0) | |
static struct | |
{ | |
DWORD process_id; | |
char data[4096 - sizeof(DWORD)]; | |
}* ods_buffer; |
This file contains 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
// example how to set up OpenGL core context on X11 with EGL | |
// and use basic functionality of OpenGL 4.5 version | |
// to compile on Ubuntu first install following packages: build-essential libx11-dev libgl-dev libegl-dev, then run: | |
// gcc x11_opengl.c -o x11_opengl -lm -lX11 -lEGL | |
// important extension functionality used here: | |
// (4.3) KHR_debug: https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_debug.txt | |
// (4.5) ARB_direct_state_access: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_direct_state_access.txt | |
// (4.1) ARB_separate_shader_objects: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_separate_shader_objects.txt |
This file contains 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
#define COBJMACROS | |
#define NOMINMAX | |
#define WIN32_LEAN_AND_MEAN | |
#include <windows.h> | |
#include <d3d11.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <intrin.h> |
This file contains 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
# Warning: this implementation doesn't check if writes or reads will happen | |
# out of input/output buffer range, so that will generate IndexError exception | |
def LZ4_decompress(source, osize): | |
isize = len(source) | |
src = bytearray(source) | |
dst = bytearray(osize) | |
si = 0 |
This file contains 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
#!/usr/bin/env python3 | |
# packs multiple images (bmp/png/...) into ico file | |
# width and height of images must be <= 256 | |
# pixel format of images must be 32-bit RGBA | |
import argparse | |
import struct | |
import os | |
from PIL import Image # https://python-pillow.org/ |
This file contains 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
// gcc -g demo.c -ldl | |
#define _GNU_SOURCE | |
#include <stdio.h> | |
#include <dlfcn.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <signal.h> | |
#include <unistd.h> |