Skip to content

Instantly share code, notes, and snippets.

View cshaa's full-sized avatar
💭
what kind of cow does oat milk come from... ?

csha cshaa

💭
what kind of cow does oat milk come from... ?
  • Czech Republic
View GitHub Profile

Prompt

If one were to create a custom OS for a DIY microcontroller-based device (for example a cyberdeck or a feature phone), what unorthodox design decisions could they take to make to make the OS interesting from a computer-theoretical standpoint? Two examples that come to my mind are: designing the OS to be used on a heterogeneous set of cores, each having different performance and capabilities; and making all executables sandboxed via WebAssembly, with configurable privileges.

Response

Creating a custom OS for a DIY microcontroller-based device with unique and theoretically interesting design decisions can lead to fascinating and innovative results. Here are several unorthodox ideas you might consider:

1. Heterogeneous Core Utilization

As you mentioned, using a heterogeneous set of cores with different performance and capabilities can lead to interesting challenges and solutions:

  • Dynamic Task Allocation: Develop algorithms for dynamically allocating tasks to the most appropriate core ba
@cshaa
cshaa / keybindings.json
Created April 9, 2024 13:01
Toggle visibility and focus of the VS Code Outline view
[
{
"key": "ctrl+alt+o",
"command": "runCommands",
"args": {
"commands": [
"outline.removeView",
"workbench.action.focusActiveEditorGroup"
]
},
@cshaa
cshaa / update-flatpak-bins.nu
Created April 3, 2024 08:21
a nushell script for adding flatpak apps to path
#!/usr/bin/env nu
const p = ~/.bin/flatpak
rm -rf $p
mkdir $p
(
flatpak list --columns=application
| lines
| where (str contains "Platform" | not $in)
| where (str contains "Gtk3theme" | not $in)
| each {|v| [$"($p)/($v)", $"#!/usr/bin/sh\nflatpak run ($v)"]}
function x
nohup fish -c "$argv &" > /dev/null && exit
end
function x_complete
set arg (commandline -ct)
complete -C$arg
end
complete --command x --arguments '(x_complete)'

Clamped Value

Idealized syntax:

component ClampedValue {
  in min: number;
  in max: number;
  
  out value = clamp(min, prev value ?? 0, max);
}
# taken from github.com/dandavison/nushell-config
export def 'set difference' [s2: list] {
# nushell doesn't have a hash table so quadratic time complexity
let s1 = ($in | sort | uniq)
let s2 = ($s2 | sort | uniq)
$s1 | where {|x| not ($x in $s2)}
}
export def 'set intersection' [s2: list] {

wheatpaste / comlink / compost

posters:

  • Window::{postMessage, on:message, on:messageerror, on:error}
  • Worker::{postMessage, on:message, on:messageerror, on:error, terminate}
  • BroadcastChannel::{postMessage, on:message, on:messageerror, close}
  • SharedWorker::{port}
  • MessageEvent::{ports}
  • MessagePort::{postMessage, on:message, on:messageerror}
  • DedicatedWorkerGlobalScope::{postMessage, on:message, on:messageerror}
@cshaa
cshaa / VDSD RFC.md
Last active February 4, 2024 00:39
Voltage-driven Supply & Demand Management

Voltage-driven Supply & Demand Management

Designing your system

  1. Determine the maximum current $I_{max}$ of the wires supporting your grid.
  2. Determine the maximum voltage drop $V_{drop}$ between two devices on your grid.
  3. Choose the level difference $V_{diff} > 2 V_{drop}$ and the top voltage $V_{top}$.
    • If you're intending to upgrade your grid to allow for higher transmitted power in the future, increasing $V_{top}$ is the easiest way to do it. Therefore it is recommended to choose a reasonable ceiling $V_{max} > V_{top}$ and select all the equipment so that it supports voltages up to $V_{max}$.
  4. Count the priority levels of sources and sinks that you want to use. A typical setup would be:
    1. (sink) Dummy load; (source) Energy harvesting
  5. (sink) Low efficiency energy storage
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"foreground": "red",
"style": "plain",
"template": "<i><d>n</d></i> ",