Skip to content

Instantly share code, notes, and snippets.

View jkoenen's full-sized avatar

Julien Koenen jkoenen

View GitHub Profile
@jkoenen
jkoenen / memory_tracker_view.cpp
Created April 8, 2019 07:48
ToolUi Memory Allocator View
#include "holistic_memory_tracker_view.hpp"
#include "keen/toolui/tui.hpp"
#include "keen/toolui/tui_widget.hpp"
#include "keen/base/pod_set.hpp"
#include "keen/base/memory_tracker.hpp"
#include "keen/dataschema/ds_type_collection.hpp"
namespace keen
{
@jkoenen
jkoenen / game_memory_allocator_model.cpp
Last active April 8, 2019 07:47
Qt Memory Allocator View+Model
#include "game_memory_allocator_model.hpp"
#include "keen/gameconnectionserver/game_connection_memory_data.hpp"
#include "keen/qtbase/numbers.hpp"
namespace keen
{
GameMemoryAllocatorModel::GameMemoryAllocatorModel( const GameMemoryDataAllocators* pAllocators, QObject* pParent /*= nullptr */ )
: QAbstractItemModel( pParent )
{
KEEN_ASSERTE( pAllocators != nullptr );
struct StaticStringView
{
inline operator StringView() const;
inline ConstMemoryBlock getMemory() const;
inline const char* getStart() const;
inline size_t getSize() const;
const char* pStart;
size_t size;
};
https://docs.google.com/presentation/d/1L820vM2mJzs_mmsn4mXle4eWkxIXHlk6WKMalJjS1Hw/edit?usp=sharing
const Result< size_t > sendResult = sendData( pNetworkCommand->data.write.pSocket->socketState.socketHandle, pNetworkCommand->data.write.source.pStart + pNetworkCommand->data.write.bytesWritten, toSend );
if( sendResult.error == ErrorId_Ok )
{
#if KEEN_USING( KEEN_NETWORK_SYSTEM_DEBUG )
pNetworkSystem->debugData.sentBytes += sendResult.value;
#endif
pNetworkCommand->data.write.bytesWritten += sendResult.value;
if( pNetworkCommand->data.write.bytesWritten == pNetworkCommand->data.write.source.size )
{
finishSocketCommand( pNetworkSocket, pNetworkSocket->writeCommands.popFront(), ErrorId_Ok );
@jkoenen
jkoenen / ryg_papers_01.md
Last active January 28, 2021 12:34
Fabians list of great papers 1/N
  1. Let's start meta: Lamport-State the Problem Before Describing the Solution (1978). https://www.microsoft.com/en-us/research/publication/state-problem-describing-solution/ … 1-page memo. Read it.
  2. Herlihy-"Wait-free synchronization" http://www.diku.dk/OLD/undervisning/2005f/dat-os/skrifter/lockfree.pdf …. Truly seminal. Lucid + enough good ideas for 4 papers easily.
  3. Cook-"How complex systems fail" (1998) https://www.researchgate.net/profile/Richard_Cook3/publication/228797158_How_complex_systems_fail/links/0c96053410db96a89c000000.pdf … 4 pages that anyone working on/with complex systems should read.
  4. Moffat, Turpin-"On the Implementation of Minimum Redundancy Prefix Codes" (1997) https://pdfs.semanticscholar.org/bda3/442cc6b1d10e4b36b574af0a34a668492230.pdf … Much has been written about Huffman coding, a lot of it wrong. Almost everything worth knowing is in this (short!) paper.
  5. Dybvig, Hieb, Butler-"Destination-Driven Code Generation" (1990) https://pdfs.semanticscholar.org/dcb8/8719880e1f76ad
section 'interface' do
export do
case get_target_platform
when :win32
import 'platform/win32/mssdk'
add_cpp_define 'CURL_STATICLIB'
add_cpp_define 'CURL_DISABLE_LDAP'
else
raise 'Unupported platform!'
end
#include "zstd.h"
#include "zdict.h"
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char* argv[] )
{
const size_t sourceDataSize = 100000u;
const size_t maxDictionarySize = 100000u;
AsyncOp<void*> async_read_compressed_file( const char* pFileName )
{
// async file open:
AsyncOp<FileHandle> openOp = async_open( pFileName );
// when the open is done: read the header:
openOp.wait(); // ????
FileHandle handle = openOp.result;