Skip to content

Instantly share code, notes, and snippets.

View es3n1n's full-sized avatar
:shipit:
the voices are getting louder

Arsenii es3n1n es3n1n

:shipit:
the voices are getting louder
View GitHub Profile
@es3n1n
es3n1n / meme.hpp
Created August 20, 2024 20:48
unfinished uniform_init_distribution drop-in replacement that utilizes https://arxiv.org/pdf/1805.10941
/// \brief A drop-in replacement for `std::uniform_int_distribution`.
///
/// We are using a replacement because the uniform_int_distribution implementation is different in libc and libstdc++.
/// This is important because otherwise we can't reproduce random values across multiple platforms.
///
/// \tparam IntType The integer type to be used for the distribution. Defaults to `int`.
template <typename IntType = int>
class UniformIntDistribution {
public:
using ResultTy = IntType;
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
./llvm.sh 17
apt install -yq libc++-17-dev libc++abi-17-dev
@es3n1n
es3n1n / uploadthing.py
Last active April 15, 2024 18:13
UploadThing upload wrapper for python3 using requests
from requests import Session, Response
from urllib.parse import quote
from typing import Tuple
from functools import lru_cache
class UploadThing:
def __init__(self, api_key: str, base_url: str = 'https://uploadthing.com/api') -> None:
self.session = Session()
self.session.headers = {
@es3n1n
es3n1n / virt2phys.cpp
Last active February 20, 2022 09:19
virt2phys
// @note: es3n1n: this is never meant to be useful
// posting cz maybe i'll use it later in my projs
// i hate those pasted c stuff, that's why i
// made my own version, please don't blame me :(
//
uintptr_t virt2phys( uintptr_t virt_addr ) {
auto read_phys = [ ] ( uintptr_t addr, void* buffer, size_t size ) -> NTSTATUS {
size_t dummy = 0;
MM_COPY_ADDRESS copy_addr = { .PhysicalAddress = {.QuadPart = static_cast< LONGLONG >( addr ) } };
@es3n1n
es3n1n / style.rb
Last active May 30, 2021 18:52
markdown linter config
all
# Use MD041 instead
exclude_rule 'MD002'
# Allow duplicate titles
exclude_rule 'MD024'
# Allow titles to end in question marks
exclude_rule 'MD026'
@es3n1n
es3n1n / e_cvar_flags.cpp
Created May 13, 2021 18:06
csgo convar flags
#include <cstdint>
enum e_cvar_flags : uint32_t {
none = 0,
unregistered = (1<<0), // If this is set, don't add to linked list, etc.
developmentonly = (1<<1), // Hidden in released products. Flag is removed automatically if ALLOW_DEVELOPMENT_CVARS is defined.
gamedll = (1<<2), // defined by the game DLL
clientdll = (1<<3), // defined by the client DLL
hidden = (1<<4), // Hidden. Doesn't appear in find or auto complete. Like DEVELOPMENTONLY, but can't be compiled out.
priv /* protected */ = (1<<5) , // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value
@es3n1n
es3n1n / idadefs.h
Last active August 21, 2024 19:42
latest definitions for hexrays decompiler output
/*
This file contains definitions used in the Hex-Rays decompiler output.
It has type definitions and convenience macros to make the
output more readable.
Copyright (c) 2007-2022 Hex-Rays
*/
@es3n1n
es3n1n / injector.cpp
Last active December 3, 2023 15:42
LoadLibraryA (LLA) injector
#include "injector.h"
#include <TlHelp32.h>
#include <stdio.h>
#define INJECTOR_FAIL(s) { printf(s " Error code: %d\n", GetLastError( ) ); return false; }
namespace injector {
namespace detail {
@es3n1n
es3n1n / math.h
Last active April 24, 2021 16:58
cpp inline asm math
namespace util {
namespace math {
constexpr auto e = 2.71828182845904523536f;
constexpr auto pi = 3.14159265358979323846f;
constexpr auto radpi = 180.f / pi;
constexpr auto sqrpi = pi * pi;
constexpr auto round_error = 0.5;
double __forceinline deg2rad( double x ) {
return x * ( static_cast< double >( pi ) / 180.0 );
@es3n1n
es3n1n / donut.cpp
Created March 14, 2021 23:18
donut.cpp
// yes.
#include <algorithm>
#define MAX_SIZE 1760
#define CHARS_MAP ".,-~:;=!*#$@"
float step_x = 0;