Skip to content

Instantly share code, notes, and snippets.

View codebrainz's full-sized avatar

Matthew Brush codebrainz

View GitHub Profile
$ cloc --exclude-dir=.git --exclude-dir=.misc --exclude-ext=d .
351 text files.
248 unique files.
211 files ignored.
github.com/AlDanial/cloc v 1.98 T=0.56 s (439.4 files/s, 35020.5 lines/s)
--------------------------------------------------------------------------------
Language files blank comment code
--------------------------------------------------------------------------------
C 60 1264 58 6614
@codebrainz
codebrainz / async.c
Created August 8, 2025 21:55
Redacted delay
diff --git a/kernel/async.c b/kernel/async.c
index 8b37a2b..b113ab0 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -17,7 +17,7 @@ void delay(uint32_t ms) {
}
}
-#define WAIT_COND (*reg & expected_value) == expected_value
+#define WAIT_COND (((*reg) & (expected_value))) == (expected_value)
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to QEMU GDB Server",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/kernel.elf",
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
#!/bin/bash
MODE="raspi"
ARGS=()
for arg in "$@"; do
case $arg in
MODE=*) MODE="${arg#MODE=}" ;;
*) ARGS+=("$arg") ;;
esac
@codebrainz
codebrainz / .clang-format
Last active May 16, 2025 04:22
WIP Clang Format style file for c3lang
# Treat C3 like C++ for clang-format
Language: Cpp
BasedOnStyle: LLVM
# Indentation & Tabs
UseTab: ForIndentation
TabWidth: 4
IndentWidth: 4
ContinuationIndentWidth: 8
@codebrainz
codebrainz / add-extensions-gpt.ts
Last active May 19, 2023 20:10
Function generated by ChatGPT to add file extensions to TS imports (untested/unverified).
import * as fs from "fs";
import * as path from "path";
function updateImportsToUseFileExtension(directoryPath: string): void {
const files = fs.readdirSync(directoryPath);
files.forEach((file) => {
const filePath = path.join(directoryPath, file);
// Check if the file is a TypeScript file
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['svelte3', '@typescript-eslint'],
ignorePatterns: ['*.cjs'],
overrides: [
{
files: ['**/*.svelte'],
processor: 'svelte3/svelte3'
@codebrainz
codebrainz / arr-min.js
Created January 4, 2023 22:43
Find the smallest number in an array in JS
function min(arr) {
if (!arr) return NaN;
let min = Number.MAX_VALUE;
for (const element of arr) {
if (element < min) {
min = element;
}
}
return min;
@codebrainz
codebrainz / strrev-copy.js
Created January 4, 2023 21:30
Reversing a string in JS.
let str1 = "hello";
let str2 = "";
for (let i = str1.length - 1; i >= 0; i--) {
str2 += str1[i];
}
console.log(str1, "=>", str2);
diff --git a/src/client/pages/graphics.svelte b/src/client/pages/graphics.svelte
index 427638c..b2af00f 100644
--- a/src/client/pages/graphics.svelte
+++ b/src/client/pages/graphics.svelte
@@ -38,7 +38,7 @@
<!-- Per Bundle; this sets the name -->
<div class="font-bold wrapper-title bg-primary text-primary-content rounded-tl-lg border-neutral-focus border-1 p-1">
<span class="text-xl">{bundle.name}</span>
- <div class="tooltip tooltip-bottom z-20" data-tip="Reload all graphics in this bundle">
+ <div class="tooltip tooltip-bottom" data-tip="Reload all graphics in this bundle">