Skip to content

Instantly share code, notes, and snippets.

@GavinRay97
GavinRay97 / Makefile
Last active September 29, 2024 02:00
WASM copy structs to memory from host -> module
WASI_VERSION_FULL = 20.0
WASMTIME_DIR = ../third-party/wasmtime-dev-x86_64-linux-c-api
WASI_SDK_PATH = ./wasi-sdk-$(WASI_VERSION_FULL)
CC = clang++
WASM_CC = $(WASI_SDK_PATH)/bin/clang++ --sysroot=$(WASI_SDK_PATH)/share/wasi-sysroot
CFLAGS = -std=c++20 -I$(WASMTIME_DIR)/include -L$(WASMTIME_DIR)/lib
LIBS = -lwasmtime
@GavinRay97
GavinRay97 / write-ahead-log.cpp
Created February 8, 2023 15:28
C++ Database Write-Ahead-Log simple proof of concept
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <optional>
#include <span>
#include <string>
// A write-ahead log is a log of all the operations that have been performed on the database.
struct LogEntryHeader
@GavinRay97
GavinRay97 / extensions.json
Created June 7, 2021 18:21
VS Code "clangd" base config, with: CMake Tools extension, MS C/C++ extension (debugging), vcpkg integration
{
"recommendations": [
"twxs.cmake",
"ms-vscode.cpptools",
"ms-vscode.cmake-tools",
"llvm-vs-code-extensions.vscode-clangd"
]
}
@Qubasa
Qubasa / CMakeLists.txt
Last active November 15, 2025 15:04
CMake with ubsan
cmake_minimum_required(VERSION 3.16)
# Set debug mode
set(CMAKE_BUILD_TYPE Debug)
if (MSVC)
message("Using MSVC")
# warning level 4 and all warnings as errors
add_compile_options(/W4 /WX)
else()

User authentication system

Your task is now to create a user authentication system.

This document will guide you through all the features and implication of such system, so that you don't have to search them yourself.

We will focus on web/browser-technologies, however similar concept can be widely applied. This guide, is a work in progress, feel free to comment and provide feedbacks.

Expected Workflows

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <string.h>
#include <stdarg.h>
#include <limits.h>
#define cast(t,p) ((t)(p))
#define szof(a) ((int)sizeof(a))
@Venemo
Venemo / mesa-howto.md
Last active November 17, 2025 04:17
How to build and use mesa from source

Building and using mesa for development and testing

This explains how to build mesa from source, and how to use the custom built mesa to run some apps and games, without needing to replace the mesa libraries that your operating system runs on.

Let's assume that you are using an x86_64 system.

Building mesa

Overview

@jlblancoc
jlblancoc / gist:44be9d4d466f0a973b1f3808a8e56782
Last active February 26, 2025 18:16
GCC sanitizer with CMake

For memory leaks

Build in CMake with these params:

CMAKE_CXX_FLAGS:STRING= -fsanitize=address  -fsanitize=leak -g
CMAKE_C_FLAGS:STRING=-fsanitize=address  -fsanitize=leak -g
CMAKE_EXE_LINKER_FLAGS:STRING=-fsanitize=address  -fsanitize=leak
CMAKE_MODULE_LINKER_FLAGS:STRING=-fsanitize=address  -fsanitize=leak

Which can be done with:

@abridgland
abridgland / gaussian-processes-1.ipynb
Last active August 24, 2025 14:36
A Jupyter notebook to accompany Intro to Gaussian Processes - Part I at http://bridg.land/posts/gaussian-processes-1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sid24rane
sid24rane / net.js
Last active June 29, 2025 18:15
Simple TCP Client and Server in Node.js (Covering all useful Properties & Methods)
var net = require('net');
// creates the server
var server = net.createServer();
//emitted when server closes ...not emitted until all connections closes.
server.on('close',function(){
console.log('Server closed !');
});