new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Bun · Runtime · all subjects

binary-data/uint8array

2 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Uint8Array base64 and hex conversion

Uint8Array has methods for converting between byte arrays and their base64 or hex string representations. To convert to base64: new Uint8Array([1, 2, 3, 4, 5]).toBase64(); // "AQIDBAU=". To convert from base64: Uint8Array.fromBase64("AQIDBAU="); // Uint8Array(5) [1, 2, 3, 4, 5]. To convert to hex: new Uint8Array([255, 254, 253, 252, 251]).toHex(); // "fffefdfcfb". To convert from hex: Uint8Array.fromHex("fffefdfcfb"); // Uint8Array(5) [255, 254, 253, 252, 251].

TextEncoder and TextDecoder

TextEncoder and TextDecoder are utility classes that translate between strings and various binary encodings, most notably UTF-8. TextEncoder#encode returns a Uint8Array. TextDecoder#decode takes a Uint8Array as input. Example: const encoder = new TextEncoder(); const bytes = encoder.encode("hello world"); // => Uint8Array(11) [ 104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100 ]. const decoder = new TextDecoder(); const text = decoder.decode(bytes); // => hello world.

Give your agent this brain