latest version here: https://gist.github.com/mmozeiko/56db3df14ab380152d6875383d0f4afd
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
#pragma once | |
#define _GNU_SOURCE | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <sched.h> | |
#include <unistd.h> | |
#include <sys/syscall.h> | |
#include <linux/perf_event.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
#!/usr/bin/env python3 | |
import sys | |
import tarfile | |
import zipfile | |
from pathlib import Path | |
src = sys.argv[1] | |
dst = Path(src).name + ".zip" |
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
@echo off | |
setlocal enabledelayedexpansion | |
rem !!! build requirements !!! | |
rem Visual Studio 2022 - https://visualstudio.microsoft.com/vs/ | |
rem 7-Zip - https://www.7-zip.org/download.html | |
rem Python - https://www.python.org/downloads/ | |
rem CMake - http://www.cmake.org/download/ | |
rem ninja.exe - https://github.com/ninja-build/ninja/releases/latest |
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 WIN32_LEAN_AND_MEAN | |
#include <winsock2.h> | |
#include <windows.h> | |
#define SECURITY_WIN32 | |
#include <security.h> | |
#include <schannel.h> | |
#include <shlwapi.h> | |
#include <assert.h> | |
#include <stdio.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
// floor function for floats with SSE1 or SSE2 | |
#include <emmintrin.h> | |
#include <smmintrin.h> | |
#ifdef _MSC_VER | |
#include <intrin.h> | |
#else | |
#define __rdtsc() __builtin_ia32_rdtsc() | |
#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
#include <windows.h> | |
#include <stdio.h> | |
#include <assert.h> // for potential error handling, change to real errors in your code | |
int main() | |
{ | |
HANDLE pipe = CreateNamedPipeW( | |
L"\\\\.\\pipe\\lolcat", | |
PIPE_ACCESS_INBOUND | FILE_FLAG_FIRST_PIPE_INSTANCE | FILE_FLAG_OVERLAPPED, | |
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS, |
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
// compile this to hook.dll | |
// for example, with MSVC: cl.exe /LD /MT /O2 hook.c /Fehook.dll | |
#include <windows.h> | |
// get this from https://github.com/kubo/plthook | |
#include "plthook_win32.c" | |
static plthook_t* hook; |
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 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") |
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
// clang.exe -Os -nostdlib -fuse-ld=lld -Wl,-fixed,-subsystem:console FlushFileCache.c -o FlushFileCache.exe | |
#define WIN32_LEAN_AND_MEAN | |
#include <windows.h> | |
#pragma comment (lib, "kernel32.lib") | |
#pragma comment (lib, "advapi32.lib") | |
#define error(str) do { DWORD written; WriteFile(GetStdHandle(STD_ERROR_HANDLE), str, sizeof(str)-1, &written, NULL); } while (0) |