notes

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 073e82007c335863ae514ba4d33da955012bb9e9
parent 226db86c65867e4de58df4fd4148886f7bb7a933
Author: ling0x <ling0x@users.noreply.github.com>
Date:   Thu, 24 Sep 2026 12:28:18 +0100

bitset

Diffstat:
Mcommands/certbot.txt | 4++--
Mcommands/docker.txt | 6+++---
Adata_structure/bitset.txt | 92+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dsystem_design/single_server.txt | 6------
Mweb_development/crdt.txt | 9+++++++--
5 files changed, 104 insertions(+), 13 deletions(-)

diff --git a/commands/certbot.txt b/commands/certbot.txt @@ -6,11 +6,11 @@ Certbot / SSL Certificates # From outside the container, test the origin directly (bypass Cloudflare): -openssl s_client -connect example.com:443 -servername sanctum.co.uk </dev/null 2>/dev/null | openssl x509 -noout -dates -subject +openssl s_client -connect example.com:443 -servername server.com </dev/null 2>/dev/null | openssl x509 -noout -dates -subject # Or if your origin IP is different from what DNS resolves to: -openssl s_client -connect <your-origin-ip>:443 -servername sanctum.co.uk </dev/null 2>/dev/null | openssl x509 -noout -dates -subject +openssl s_client -connect <your-origin-ip>:443 -servername server.com </dev/null 2>/dev/null | openssl x509 -noout -dates -subject 2. Verify your web server config points to the right paths diff --git a/commands/docker.txt b/commands/docker.txt @@ -12,7 +12,7 @@ Spin up 1 single container from a compose.yml: docker compose -f docker/compose.yml up <container-name> # stop it (keeps the container, can restart later) -docker compose -f docker/compose.dev.yml stop sanctum_frontend_dev +docker compose -f docker/compose.dev.yml stop frontend_dev # stop + remove the container (but keep volumes/networks) -docker compose -f docker/compose.dev.yml rm -sf sanctum_frontend_dev -\ No newline at end of file +docker compose -f docker/compose.dev.yml rm -sf frontend_dev +\ No newline at end of file diff --git a/data_structure/bitset.txt b/data_structure/bitset.txt @@ -0,0 +1,92 @@ +=============================================================================== +bitset +=============================================================================== + +Example: + +Each flag owns a different bit position, so they never overlap. That lets you +store any subset of them in one number: + +INDEX = 1 << 4 = 00_0001_0000 = 16 +VERTEX = 1 << 5 = 00_0010_0000 = 32 +UNIFORM = 1 << 6 = 00_0100_0000 = 64 +STORAGE = 1 << 7 = 00_1000_0000 = 128 +INDIRECT = 1 << 8 = 01_0000_0000 = 256 +QUERY_RESOLVE = 1 << 9 = 10_0000_0000 = 512 + +Each of those constants is one switch in a row of switches, and a buffer's usage +value records which switches are on. + +1. Each usage gets its own bit. INDEX is switch 4, VERTEX is switch 5, UNIFORM +is switch 6, and so on. 1 << n means "a number with only switch n turned on." + +2. Combining usages means turning on several switches. If you create a buffer +with VERTEX | INDEX | UNIFORM, you get: + + 00_0001_0000 INDEX + 00_0010_0000 VERTEX + 00_0100_0000 UNIFORM + ──────────── OR them together + 00_0111_0000 = 112 + +The single number 112 means "this buffer may be used as an index buffer, +a vertex buffer, and a uniform buffer." + + + +wgpu-types/src/buffer.rs + +bitflags::bitflags! { + /// Different ways that you can use a buffer. + /// + /// The usages determine what kind of memory the buffer is allocated from and what + /// actions the buffer can partake in. + /// + /// Specifying only usages the application will actually perform may increase performance. + /// Additionally, on the WebGL backend, there are restrictions on [`BufferUsages::INDEX`]; + /// see [`DownlevelFlags::UNRESTRICTED_INDEX_BUFFER`] for more information. + /// + /// Corresponds to [WebGPU `GPUBufferUsageFlags`]( + /// https://gpuweb.github.io/gpuweb/#typedefdef-gpubufferusageflags). + #[repr(transparent)] + #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] + #[cfg_attr(feature = "serde", serde(transparent))] + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] + pub struct BufferUsages: u32 { + /// Allow a buffer to be mapped for reading using [`Buffer::map_async`] + [`Buffer::get_mapped_range`]. + /// This does not include creating a buffer with [`BufferDescriptor::mapped_at_creation`] set. + /// + /// If [`Features::MAPPABLE_PRIMARY_BUFFERS`] isn't enabled, the only other usage a buffer + /// may have is COPY_DST. + const MAP_READ = 1 << 0; + /// Allow a buffer to be mapped for writing using [`Buffer::map_async`] + [`Buffer::get_mapped_range_mut`]. + /// This does not include creating a buffer with [`BufferDescriptor::mapped_at_creation`] set. + /// + /// If [`Features::MAPPABLE_PRIMARY_BUFFERS`] feature isn't enabled, the only other usage a buffer + /// may have is COPY_SRC. + const MAP_WRITE = 1 << 1; + /// Allow a buffer to be the source buffer for a [`CommandEncoder::copy_buffer_to_buffer`] or [`CommandEncoder::copy_buffer_to_texture`] + /// operation. + const COPY_SRC = 1 << 2; + /// Allow a buffer to be the destination buffer for a [`CommandEncoder::copy_buffer_to_buffer`], [`CommandEncoder::copy_texture_to_buffer`], + /// [`CommandEncoder::clear_buffer`] or [`Queue::write_buffer`] operation. + const COPY_DST = 1 << 3; + /// Allow a buffer to be the index buffer in a draw operation. + const INDEX = 1 << 4; + /// Allow a buffer to be the vertex buffer in a draw operation. + const VERTEX = 1 << 5; + /// Allow a buffer to be a [`BufferBindingType::Uniform`] inside a bind group. + const UNIFORM = 1 << 6; + /// Allow a buffer to be a [`BufferBindingType::Storage`] inside a bind group. + const STORAGE = 1 << 7; + /// Allow a buffer to be the indirect buffer in an indirect draw call. + const INDIRECT = 1 << 8; + /// Allow a buffer to be the destination buffer for a [`CommandEncoder::resolve_query_set`] operation. + const QUERY_RESOLVE = 1 << 9; + /// Allows a buffer to be used as input for a bottom level acceleration structure build + const BLAS_INPUT = 1 << 10; + /// Allows a buffer to be used as input for a top level acceleration structure build + const TLAS_INPUT = 1 << 11; + } +} + diff --git a/system_design/single_server.txt b/system_design/single_server.txt @@ -1,6 +0,0 @@ -# Single Server Setup - -The simplest design is everything running on a single server: web app, database, -cache, etc. - -<img src="/assets/single_server.png" alt="Single Server Setup" width="100%"> diff --git a/web_development/crdt.txt b/web_development/crdt.txt @@ -2,7 +2,11 @@ CRDT https://www.bartoszsypytkowski.com/the-state-of-a-state-based-crdts/ -We can discrimitate CRDTs using two core categories: state-based (convergent) and operation-based (commutative) data types. No matter which one we talk about, they all consists of two parts: replication protocol and state application algorithms. +We can discrimitate CRDTs using two core categories: +state-based (convergent) and operation-based (commutative) data types. + +No matter which one we talk about, they all consists of two parts: +replication protocol and state application algorithms. - Replication Protocol - State Application Algorithms @@ -18,7 +22,8 @@ Merge operation must conform to three properties: 3. Idempotency (x . x = x), so we don't need to care about potential duplicates send from replication layer -Those properties are not easy to guarantee, but you're going to see how far we can go only by using two basic operations, which meet those criteria: +Those properties are not easy to guarantee, but you're going to see how far we +can go only by using two basic operations, which meet those criteria: - union of two sets - maximum of two values