Skip to content

Instantly share code, notes, and snippets.

View NHollmann's full-sized avatar
📖
Learning new things every day!

Nicolas Hollmann NHollmann

📖
Learning new things every day!
View GitHub Profile
@NHollmann
NHollmann / anymap.c
Created August 27, 2019 20:33
Portable Anymap
// Portable Pixmap in C example.
// Compile with: gcc anymap.c -o anymap
// Tutorial: https://nicolashollmann.de/blog/writing-portable-anymap/
#include <stdio.h>
#define WIDTH 300
#define HEIGHT 200
// Uncomment to write binary instead of ASCII
@NHollmann
NHollmann / bmp.c
Created April 1, 2021 11:37
Windows Bitmap
// Windows Bitmap in C example.
// Compile with: gcc bmp.c -o bmp
// Tutorial: https://nicolashollmann.de/blog/writing-bmp-files/
#include <stdio.h>
#include <stdint.h>
#define WIDTH 300
#define HEIGHT 200
@NHollmann
NHollmann / dynamicCodeWin.c
Last active April 3, 2021 00:37
Run dynamic code on Windows (x86)
// Run dynamic code on Windows (x86)
// Compile with: gcc -o dynamicCodeWin dynamicCodeWin.c
// Tutorial: https://nicolashollmann.de/blog/run-dynamic-code-windows/
#include <stdio.h>
#include <stdbool.h>
#include <Windows.h>
/**
* Helper function to execute dynamic code.
@NHollmann
NHollmann / dynamicCodeUnix.c
Created April 3, 2021 00:36
Run dynamic code on Unix (x86)
// Run dynamic code on Unix (x86)
// Compile with: gcc -o dynamicCodeUnix dynamicCodeUnix.c
// Tutorial: https://nicolashollmann.de/blog/run-dynamic-code-unix/
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <sys/types.h>
#include <sys/mman.h>