Skip to content

Instantly share code, notes, and snippets.

View Lima-X's full-sized avatar
🥛
__ライムコール

Lima X Lima-X

🥛
__ライムコール
  • Technical University of Darmstadt
  • Germany
  • 23:15 (UTC +02:00)
  • X @LimaXv3
View GitHub Profile
@Lima-X
Lima-X / ImguiSpdLog.cc
Created February 26, 2022 15:06
A high performance filtered and configurable spdlog sink for dear imgui - (TODO: Add filter double buffering and deuglify)
// TODO: work on filters, they are really needed, did optimize the memory storage quite a bit tho
class ImGuiSpdLogAdaptor
: public spdlog::sinks::base_sink<std::mutex> {
using sink_t = spdlog::sinks::base_sink<std::mutex>;
class SinkLineContent {
public:
spdlog::level::level_enum LogLevel; // If n_levels, the message pushed counts to the previous pushed line
int32_t BeginIndex; // Base offset into the text buffer
@Lima-X
Lima-X / memelloc.cc
Last active August 27, 2021 15:05
MemeAllocator a new futuristic type of memory allocation based on dynamically generated images, ok fuck it, this was a very dumb thing to design
// This thing is based on a stupid idea that came after a bet that i had with @LapysDev
#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <cstdint>
constexpr uint32_t RoundUpToMulOfPow2(
_In_ uint32_t Number,
_In_ int32_t Multiplier
) {
@Lima-X
Lima-X / tapc.cpp
Last active October 12, 2022 18:10
ThreadInterruptApcService - Small API to Interrupt a Thread, hijack it to execute a Callback (ISR) and continue normal execution (x64)
#include <Windows.h>
#include <winternl.h>
#include <cstdio>
#pragma comment(lib, "ntdllp.lib")
DWORD __stdcall TestThread(
_In_ void* reserved
) {
for (UINT64 i = 0; i < (UINT64)-1; i++) {
printf("TestThread\n");
@Lima-X
Lima-X / rc4.c
Created January 9, 2021 14:58
C/C++ RC4 Crypto Algorithm Implementation
void rc4crypt( // Crypts a buffer with RC4 cipher (RC4 modification)
unsigned char* Input, // The input data to be crypted
size_t InputLength, // The length of the input in bytes
unsigned char* Key, // The key to be used in the encryption
unsigned short KeyLength, // The length of the key to use in bytes
unsigned char* Output // The output buffer to be filled (can be inplace)
) {
// Substitution-Box and State
unsigned char SBox[256];
unsigned char i = 0, j = 0;
@Lima-X
Lima-X / Benchmark.cpp
Last active October 7, 2020 21:46
Windows High-Precision and light Benchmark Class Implementation using PerformanceCounters
#include <Windows.h>
class Benchmark {
public:
enum class Resolution {
SEC = 1,
MILLI = 1000,
MICRO = 1000000,
NANO = 1000000000
};
@Lima-X
Lima-X / HexConverter.cpp
Last active September 13, 2020 11:27
A fast C++ Hexconverter-Class using a Lookuptable (for ANSI and lowercase only)
class HexConv {
public:
HexConv() {
// Setup HexTable
for (char i = 0; i < 10; i++)
m_HexTable[i] = i + '0';
for (char j = 0; j < 6; j++) {
m_HexTable[j + 10] = j + 'a';
m_HexTable[j + ('a' - '0')] = j + ('0' + 10);