Skip to content

Instantly share code, notes, and snippets.

View RealNeGate's full-sized avatar

Yasser Arguelles Snape RealNeGate

  • Washington, USA
View GitHub Profile
@RealNeGate
RealNeGate / evil.c
Last active February 8, 2023 00:18
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
int s[1024],i=0,a,b,m[4096];
char *d[256],e;
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define SWEETIE_IMPL
#include "sweetie.h"
static char* read_entire_file(const char* filepath) {
FILE* file = fopen(filepath, "rb");
if (file == NULL) {
fprintf(stderr, "error: could not open '%s'\n", filepath);
#define UNICODE
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@RealNeGate
RealNeGate / build.lua
Last active September 12, 2022 09:56
local bit = require("bit")
local ffi = require("ffi")
function get_file_name(file)
local s = file:match("^.+/(.+)$")
if s == nil then
return file
end
return s

Code generation

ABI Switching

Optimizers

Ramblings about code optimization.

TODO

#define UNICODE
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
// I'm going to hell for this one...
//
// https://godbolt.org/z/PjxjveaG4
#include <stdbool.h>
#include <stddef.h>
#ifdef __clang__
#define typeof(x) __typeof__(x)
#endif
#define NL_STRING_MAP_IMPL
#include "string_map.h"
int main() {
NL_StringMap table = nl_string_map_init(7);
nl_string_map_insert_cstr(&table, "glRasterPos4iv", NULL);
nl_string_map_insert_cstr(&table, "PackTouchHitTestingProximityEvaluation", NULL);
nl_string_map_insert_cstr(&table, "GetPointerPenInfo", NULL);
nl_string_map_insert_cstr(&table, "GetCIMSSM", NULL);
// Reject modernity, return to wrinkly ass GL shit
#if !defined(_WIN32)
#error "Fuck you"
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <GL/gl.h>
#pragma comment(lib, "opengl32.lib")
// I tried not doing anything too non-portable so it should be possible to run
// this on Mac or Linux... probably... even then, you can't use the obj files there
//
// once you have the obj file you should be able to do:
// link YOUROBJ.obj /defaultlib:libcmt
// ^^^^^^^^^^^^^^^^^^
// linking against crt
#define _CRT_SECURE_NO_WARNINGS
#include <stdint.h>
#include <stdlib.h>