Skip to content

Instantly share code, notes, and snippets.

View brokenprogrammer's full-sized avatar
🧠

Oskar Mendel brokenprogrammer

🧠
View GitHub Profile
@brokenprogrammer
brokenprogrammer / Ships.csv
Created August 29, 2025 15:39
Evedle.net Ship Data
Name Faction Class Size Role Tech
Impairor Amarr Corvette Small Rookie T1
Ibis Caldari Corvette Small Rookie T1
Velator Gallente Corvette Small Rookie T1
Reaper Minmatar Corvette Small Rookie T1
Magnate Amarr Frigate Small Exploration T1
Punisher Amarr Frigate Small Combat T1
Tormentor Amarr Frigate Small Combat T1
Crucifier Amarr Frigate Small EWAR T1
Executioner Amarr Frigate Small Tackle T1
// This is code that I wrote for the q2 angelscript project to help improve the API that the q2 code use to check and get types
// from the yyjson library.
// It is nothing ground breaking but it was interesting to write at the time.
template<typename TargetType, typename SourceType>
constexpr bool q2as_type_in_range(SourceType value)
{
// Prevent bool as TargetType or SourceType to avoid edge cases
static_assert(!std::is_same_v<TargetType, bool>, "TargetType cannot be bool");
static_assert(!std::is_same_v<SourceType, bool>, "SourceType cannot be bool");
bool
_IsEmpty(threadpool* Threadpool)
{
return ((Threadpool->WorkWriteIndex - Threadpool->WorkReadIndex) == 0);
}
bool
_HasWorkInQueue(threadpool* Threadpool)
{
return ((Threadpool->WorkWriteIndex - Threadpool->WorkReadIndex) != 0);
@brokenprogrammer
brokenprogrammer / LBPSerialization.cpp
Created April 24, 2022 10:45
Implementation of LBP Serializer
// This is a reference implementation that I wrote to understand and to keep my own archive of the LBP Serializer
// as well as to try it out before using it within Brainroll.
// Oswald Hurlem presents this in his article: https://yave.handmade.network/blog/p/2723-how_media_molecule_does_serialization
// Credit goes to him and of course the people at Media Molecule.
//
// This implementation also briefly showcases the example use of CHECK_INTEGRITY which you can place in places
// where it makes sense for you.
//
// Build with: cl.exe -nologo /Zi /FC LBPSerialization.cpp /link -opt:ref -incremental:no /Debug:full /out:lbp.exe
@brokenprogrammer
brokenprogrammer / lzw_decode.c
Last active April 7, 2022 06:30
Simple LZW 16bit fixed width decoder
//
// This is a implementation of a simple lzw 16bit fixed width decoder
// that I created after listening to Casey Muratori's talk during stream
// LZW WTF. Within the talk Casey explains the idea behind a lzw decoder
// using the generated output as its string table instead of performing
// mallocs, using a linked list for strings followed by chasing
// pointers to output the string or relying on std::string which performs
// both malloc/free under the hood while decoding.
//
// I wanted to try out the approach he mentions in something simple so
@brokenprogrammer
brokenprogrammer / win32_sock.c
Created February 15, 2022 19:28
Reference implementation for AcceptEx based Event based Overlapped (Asynchronous) I/O TCP Echo Server.
#define Win32OutputWSAErrorCode printf
#define Win32OutputErrorCode printf
static int
Win32InitializeWinsock()
{
WSADATA WSAData;
if (WSAStartup(MAKEWORD(2, 2), &WSAData) != 0)
{
Win32OutputWSAErrorCode("WSAStartup Failed");
@brokenprogrammer
brokenprogrammer / win32_sock.c
Last active February 14, 2022 19:50
Reference implementation for Event based Overlapped (Asynchronous) I/O TCP Echo Server.
#define Win32OutputWSAErrorCode printf
#define Win32OutputErrorCode printf
DWORD WINAPI
_Win32NetworkListeningThreadProc(LPVOID lpParameter)
{
win32_mprof_net_state *State = (win32_mprof_net_state *)lpParameter;
win32_mprof_sock_connection *SocketConnection;
DWORD BytesTransferred;