Standard escape codes are prefixed with Escape:
- Ctrl-Key:
^[ - Octal:
\033 - Unicode:
\u001b - Hexadecimal:
\x1B - Decimal:
27
| typedef struct intern_t { | |
| intern_t *next; | |
| uint32_t length; // can be narrower if you want to limit internable string length, which is a good idea. | |
| char str[1]; | |
| } intern_t; | |
| hashtable_t string_table; | |
| const char *string_intern(const char *str, uint32_t length) { | |
| uint64_t key = string_hash(str, length); |
| # Version 0: Use slice views to access a matrix like a block matrix. | |
| def blocked_matrix_multiply0(A, B, block_size, panel_size): | |
| m, p, n = A.shape[0], A.shape[1], B.shape[1] | |
| w, h = block_size, panel_size | |
| C = np.zeros((m, n)) | |
| for i in range(0, m, w): | |
| for j in range(0, p, h): | |
| row_panel = A[i:i+w, j:j+h] | |
| for k in range(0, n, w): | |
| column_panel = B[j:j+h, k:k+w] |
| #version 300 es | |
| precision highp float; | |
| in vec2 UV; | |
| out vec4 out_color; | |
| uniform float ratio, time; | |
| uniform sampler2D texture0; | |
| const float PI_3 = 1.0471975512; |
| /* clang-format off */ | |
| /* | |
| ijss : IncredibleJunior SparseSet | |
| sparse set [1] for bookkeeping of dense<->sparse index mapping or | |
| a building block for a simple LIFO index/handle allocator | |
| [1] https://research.swtch.com/sparse | |
| */ |
Below are the steps to get an ARM64 version of Ubuntu running in the QEMU emulator on Windows 10.
Install for Windows from https://qemu.weilnetz.de/w64/ (I used qemu-w64-setup-20181211.exe)
Put C:\Program Files\qemu on your PATH, and run the below to check it's working (which will list out
the CPUs the AArch64 emulator can emulate):
qemu-system-aarch64 -M virt -cpu help
| // Decompresses LZ4 found in XNB (just a test tool for vgmstream). | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <stdint.h> | |
| #include <string.h> | |
| /* Decompresses LZ4 from MonoGame. The original C lib has a lot of modes and configs, but | |
| * MonoGame only uses the core 'block' part, which is a fairly simple LZ77 (has one command | |
| * to copy literal and window values, with variable copy lengths). |
| // generic A* pathfinding | |
| // | |
| // INTERFACE | |
| // | |
| // mandatory macros | |
| #ifndef ASTAR_POS_TYPE | |
| #error ASTAR_POS_TYPE should specify position type |
| // Heavily based on ideas from https://github.com/LuaJIT/LuaJIT/blob/v2.1/src/lj_opt_fold.c | |
| // The most fundamental deviation is that I eschew the big hash table and the lj_opt_fold() | |
| // trampoline for direct tail calls. The biggest problem with a trampoline is that you lose | |
| // the control flow context. Another problem is that there's too much short-term round-tripping | |
| // of data through memory. It's also easier to do ad-hoc sharing between rules with my approach. | |
| // From what I can tell, it also isn't possible to do general reassociation with LJ's fold engine | |
| // since that requires non-tail recursion, so LJ does cases like (x + n1) + n2 => x + (n1 + n2) | |
| // but not (x + n1) + (y + n2) => x + (y + (n1 + n2)) which is common in address generation. The | |
| // code below has some not-so-obvious micro-optimizations for register passing and calling conventions, | |
| // e.g. the unary_cse/binary_cse parameter order, the use of long fields in ValueRef. |