Public
Edited
Dec 10, 2024
Importers
1 star
Insert cell
Insert cell
Bill_of_materials = `bill of materials

| Qt | Part | :us: USA | :it: Italy | :uk: UK | :netherlands: NL | Notes |
|----|------|----------|------------|---------|------------------|-------|
| 1 | NVIDIA Jetson Nano | [NVIDIA store](https://developer.nvidia.com/embedded/buy/jetson-nano-devkit) | | | | You can use **2Gb** or **4Gb** version<br>Buy this alternative carrier:<br>[SEEED studio](https://www.seeedstudio.com/Jetson-10-1-H0-p-5335.html) |
| 1 | MicroSD card 64Gb | :us: $9.99<br>[Amazon](https://amzn.to/2X7rWpH) | :it:<br>[Amazon](https://amzn.to/3mxPCR1) | :uk:<br>[Amazon](https://amzn.to/3qv95mB) | :netherlands:<br>[Amazon](https://amzn.to/3pw9FS1) | |
| 1 | 128GB NVM3 M.2 PCLe SSD | | | | | **Only for SEEED STUDIO carrier**<br>[NVMe M.2](https://www.seeedstudio.com/M-2-2280-SSD-128GB-p-5332.html) |
| 1 | Wi-Fi Dongle 5Ghz | :us: $13.90<br>[Amazon](https://amzn.to/3mDiBTE) | :it:<br>[Amazon](https://amzn.to/3qOI3qP) | :uk:<br>[Amazon](https://amzn.to/3sJXsen) | :netherlands:<br>[Amazon](https://amzn.to/3HgC5FB) | |
| 1 | Power Bank | :us: $29.99<br>[Amazon](https://amzn.to/2X8RNha) | :it:<br>[Amazon](https://amzn.to/3syJ4Wl) | :uk:<br>[Amazon](https://amzn.to/3ey5bnm) | :netherlands:<br>[Amazon](https://amzn.to/3mB7eMd) | [Power Bank dimensioning](/optional/power-bank) |
| 2 | Pololu Micro Gearbox | :us: $25.75<br>[Amazon](https://amzn.to/3hS4o1P) | :it:<br>[Amazon](https://amzn.to/3JjEwZP) | :uk:<br>[Amazon](https://amzn.to/3ey58YI) | :netherlands:<br>[Amazon](https://amzn.to/3HgMG3j) | [Pololu 6V 150RPM](https://www.pololu.com/product/2368)<br> **alternative**:<br>[aliexpress.com](https://www.aliexpress.com/item/4000274747864.html) |
| 1 | Adafruit motor control | :us: $29.10<br>[Amazon](https://amzn.to/392GhZU) | :it:<br>[Amazon](https://amzn.to/3psMwjk) | :uk:<br>[Amazon](https://amzn.to/3162czI) | :netherlands:<br>[Amazon](https://amzn.to/3H6VYPo) | [DC Motor + Stepper FeatherWing Add-on](https://www.adafruit.com/product/2927)<br> **alternative**:<br>[aliexpress.com](https://www.aliexpress.com/item/4001089410177.html) |
| 2 | oled display | :us: $5<br>[Amazon](https://amzn.to/3ocB3kJ) | :it:<br>[Amazon](https://amzn.to/3EwAObC) | :uk:<br>[Amazon](https://amzn.to/3HavufG) | :netherlands:<br>[Amazon](https://amzn.to/3EwYaxK) | 128x64px 0.06in I2C<br> Best price pack:<br>[3 display](https://amzn.to/3d6Qgkv) |
| 6 | Ball bearings **F686ZZ** | :us: $7.49<br>[Amazon](https://amzn.to/3dIs8DJ) | :it:<br>[Amazon](https://amzn.to/3z0zeh4) | :uk:<br>[Amazon](https://amzn.to/3qmJVqc) | :netherlands:<br>[Amazon](https://amzn.to/3Hay856) | **alternative**:<br>[aliexpress.com](https://www.aliexpress.com/item/32862353983.html) |
| 10 | Magnets 4x2mm | :us: $10.99<br>[Amazon](https://amzn.to/3pwnnTp) | | | :netherlands:<br>[Amazon](https://amzn.to/3z1FgOD) | **alternative**:<br>[aliexpress.com](https://www.aliexpress.com/item/1005001530483863.html) |
| - | Expansion board | | | | | [Expansion board](#expansion-board) |
| - | 3D parts | | | | | [3D filaments](#3d-filaments) |
| - | Hex M2 Screw set | :us: $10*<br>Amazon | | | | [Screw set](#screw-set) |
`
Insert cell
md`Bill of materials ${Bill_of_materials}`
Insert cell
rtings --- use llama in the loop to parse all hardware companies nv
Insert cell
Insert cell
zed_2i = {
}
Insert cell
trossen = {
//try dynamixelSDK - directly via JS/ZIG
// try huggingface - lerobot

}
Insert cell
roomba_ = html`<iframe width="960" height="500" src="https://python.irobot.com/"></iframe>`
Insert cell
import { viewof set } from "@enjalot/t-sne-grid-selector"
Insert cell
set
Insert cell
import {
viewof input,
drawing
} from "@enjalot/replicate-api-controlnet-scribble"
Insert cell
_ = drawing() // draw = design hardware components
Insert cell
Insert cell
// import { Whiteboard } from 'whiteboard-react';

// <Whiteboard />
Insert cell
//JSON.parse(bun_cell_executed.stdout)
Insert cell
//visualize entire deps map of each file + mini_zoox
Insert cell
deno_demo_code = d3.text(
"https://raw.githubusercontent.com/denoland/webgpu-examples/refs/heads/main/cube/mod.ts"
)
Insert cell
html`<img src="http://localhost:8080/user_code/output.png"/>`
Insert cell
html`<img src="${base_route}/user_code/output.png"/>
https://github.com/denoland/webgpu-examples/blob/main/boids/mod.ts
https://observablehq.com/@tmcw/observable-anti-patterns-and-code-smells
https://io.google/2024/speakers/austin-eng/`
Insert cell
https://login.tailscale.com/admin/invite/e4rP9sJ59bJ
Insert cell
Insert cell
viewof randomize = html`<button>Randomize color</button>`
Insert cell
lightFactory = function lightFactory(_) {
return { pos: { x: 0, y: 0, z: 0 }, color: "#ffffff", fov: 60 };
}
Insert cell
lightSliders = {
const i = 0;
let xSlider = Inputs.range([-20, 20], {
label: `Light ${i + 1} X`,
value: lightFactory().pos.x
});
let ySlider = Inputs.range([-20, 20], {
label: `Light ${i + 1} Y`,
value: lightFactory().pos.y
});
let zSlider = Inputs.range([-20, 20], {
label: `Light ${i + 1} Z`,
value: lightFactory().pos.z
});
let colorPicker = Inputs.color({
label: `Light ${i + 1} Color`,
value: lightFactory().color
});
let fovSlider = Inputs.range([30, 120], {
label: `Light ${i + 1} FOV`,
value: lightFactory().fov
});

return html`${fovSlider}${colorPicker}${zSlider}${ySlider}${xSlider}`;
}
Insert cell
//https://observablehq.com/d/82142d5b142796ea#cell-618
Insert cell
{
// Define the inputs for progress, sides, offset, and threshold
const progress = Inputs.range([0.001, 1], {
step: 0.001,
value: 0.4,
label: "Progress"
});

const sides = Inputs.range([3, 32], {
step: 1,
value: 32,
label: "Sides"
});

const offset = Inputs.range([-0.3, 0.3], {
step: 0.01,
value: 0.0,
label: "Offset"
});

const threshold = Inputs.checkbox(["Threshold"], {
value: [] // initial unchecked
});

// Function to draw based on input values
function draw() {
// regl.poll(); // Assuming you're using regl.js for rendering
// regl.drawField({
// progress: progress.value, // Get value from progress slider
// sides: sides.value, // Get value from sides slider
// offset: offset.value, // Get value from offset slider
// threshold: threshold.value.includes("Threshold") // Checkbox logic
// });
}

// Add event listeners to redraw whenever an input changes
[progress, sides, offset, threshold].forEach((input) =>
input.addEventListener("input", draw)
);

// Perform the initial draw
draw();

// Return the HTML structure combining all inputs
return html`${progress}${sides}${offset}${threshold}`;
}
Insert cell
entitySlider = {
const colorPicker = Inputs.range([0.001, 1], {
step: 0.001,
value: 0.4,
label: "colorPicker"
});

const rotationSpeedSlider = Inputs.range([3, 32], {
step: 1,
value: 32,
label: "rotationSpeedSlider"
});

const offset = Inputs.range([-0.3, 0.3], {
step: 0.01,
value: 0.0,
label: "Offset"
});
const entities = [...Array(3).keys()].map((i) => ({
rotationSpeed: 0,
color: "#00ff00"
}));

const sliders = entities.map((entity, i) => {
return {
entity,
rotationSpeedSlider: Inputs.range([-1, 1], {
label: `Cube ${i + 1} Rotation Speed`,
value: entity.rotationSpeed
}),
colorPicker: Inputs.color({
label: `Cube ${i + 1} Color`,
value: entity.color
})
};
});

return html`${offset}${rotationSpeedSlider}${colorPicker}`;
}
Insert cell
viewof LightPositionX = Inputs.range([0, 100], {
label: "Light position x",
value: 50
})
//cmd -enter
Insert cell
viewof lightPositionY = Inputs.range([0, 100], {
label: "Light position y",
value: 50
})
Insert cell
viewof lightPositionZ = Inputs.range([0, 100], {
label: "Light position z",
value: 50
})
Insert cell
viewof lightColorR = Inputs.range([0, 255], {
label: "Light color r",
value: 125
})
Insert cell
viewof lightColorG = Inputs.range([0, 255], {
label: "Light color g",
value: 125
})
Insert cell
viewof lightColorB = Inputs.range([0, 255], {
label: "Light color b",
value: 125
})
Insert cell
viewof lightFOV = Inputs.range([0, 180], { label: "Light FOV", value: 90 })
Insert cell
viewof lightDepthNear = Inputs.range([0, 100], {
label: "Light near plane",
value: 1
})
Insert cell
viewof lightDepthFar = Inputs.range([0, 100], {
label: "Light far plane",
value: 100
})
Insert cell
viewof entityColorR = Inputs.range([0, 255], {
label: "Entity color r",
value: 125
})
Insert cell
viewof entityColorG = Inputs.range([0, 255], {
label: "Entity color g",
value: 125
})
Insert cell
viewof entityColorB = Inputs.range([0, 255], {
label: "Entity color b",
value: 125
})
Insert cell
viewof entityRotationSpeed = Inputs.range([0, 100], {
label: "Entity rotation speed",
value: 50
})
Insert cell
viewof ambientLightIntensity = Inputs.range([0, 100], {
label: "Ambient light intensity",
value: 50
})
Insert cell
viewof numberOfActiveLights = Inputs.range([0, 10], {
label: "Number of active lights",
value: 1
})
Insert cell
viewof shadowBias = Inputs.range([-1, 1], { label: "Shadow bias", value: 0 })
Insert cell
viewof shadowBiasSlopeScale = Inputs.range([-1, 1], {
label: "Shadow bias slope scale",
value: 0
})
Insert cell
Insert cell
viewof sceneColor = Inputs.color({
label: "Scene Background Color",
value: "#000000"
})
Insert cell
viewof cameraSlider = Inputs.number({ label: "camera", value: 0 }) //rreusser
Insert cell
LightPositionX
Insert cell
scene_parameters = {
return {
// cameraSlider,
// sceneColor,

LightPositionX,
// lightPositionY,
lightPositionZ,
lightColorR,
lightColorG,
lightColorB,
lightFOV,
lightDepthNear,
lightDepthFar
};
}
Insert cell
(randomize, deno_webgpu(scene_parameters))
Insert cell
result = deno_webgpu(scene_parameters)
Insert cell
deno_webgpu = (scene_parameters) => {
let buffer = {};
// const url = `https://shels-macbook-pro.jerboa-kokanue.ts.net/make-bun-cell`;

const url = `${base_route}0/make_deno_cell`;
// import all bun examples as tests
//import all deno examples as test
const data = {
file_name: "initial_webgpu_test",
deno_code: deno_demo_code + "console.log('complete rendering')",
datum: scene_parameters
};

let req = fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(data) // Data to be sent in the POST request
});

req
.then((response) => {
if (!response.ok)
throw new Error(`HTTP error! status: ${response.status}`);
return response.json(); // Parse the JSON from the response
})
.then((json) => console.log("Response Data:", Object.assign(buffer, json))) // Handle the JSON data
.catch((error) => console.error("Error fetching data:", error));

return buffer;
}
Insert cell
bun_cell_executed = {
// const url = `https://shels-macbook-pro.jerboa-kokanue.ts.net/make-bun-cell`;
const url = `${base_route}/make_bun_cell`;
// import all bun examples as tests
//import all deno examples as test
const data = {
file_name: "initial_test",
bun_code: "console.log(fs.readdirSync('./'))"
};

// const req = await d3.json(url, {
// method: "POST",
// body: JSON.stringify(data),
// headers: { "Content-Type": "application/json" }
// });

let req = fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(data) // Data to be sent in the POST request
});
let buffer = {};
req
.then((response) => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json(); // Parse the JSON from the response
})
.then((json) => {
// buffer += JSON.stringify(json);
Object.assign(buffer, json);
console.log("Response Data:", json); // Handle the JSON data
})
.catch((error) => {
console.error("Error fetching data:", error); // Handle any errors
});
// .then((response) => response.json())
// .then((data) => {
// console.log(data);
// buffer = data;
// })
// .catch((error) => {
// console.log(error);
// // console.error("Error:", error);
// });

return buffer;

//learn docker, k8, slurm, (tree_sitter/acorn/browserify)
// obs std runtime + github
// eslint + code_mirror
}
Insert cell
// import { Tldraw, TldrawApp, TDDocument } from "@tldraw/tldraw"
Insert cell
deno_cell_executed = {
// const url = `https://shels-macbook-pro.jerboa-kokanue.ts.net/make-bun-cell`;
const url = `${base_route}/make_deno_cell`;

const data = {
file_name: "initial_deno_test",
deno_code: "console.log(fs.readdirSync('./'))"
};

let req = fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(data) // Data to be sent in the POST request
});
let buffer = {};
req
.then((response) => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json(); // Parse the JSON from the response
})
.then((json) => {
// buffer += JSON.stringify(json);
Object.assign(buffer, json);
console.log("Response Data:", json); // Handle the JSON data
})
.catch((error) => {
console.error("Error fetching data:", error); // Handle any errors
});

return buffer;
}
Insert cell
python_cell_executed = {
//mojo / triton todo
// const url = `https://shels-macbook-pro.jerboa-kokanue.ts.net/make-bun-cell`;
const url = `${base_route}/make_python_cell`;
// import all bun examples as tests
//import all deno examples as test
const data = {
file_name: "initial_python_test",
python_code: "print(os.listdir('./'))"
};

let req = fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(data) // Data to be sent in the POST request
});
let buffer = {};
req
.then((response) => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json(); // Parse the JSON from the response
})
.then((json) => {
// buffer += JSON.stringify(json);
Object.assign(buffer, json);
console.log("Response Data:", json); // Handle the JSON data
})
.catch((error) => {
console.error("Error fetching data:", error); // Handle any errors
});

return buffer;
}
Insert cell
// import 'tldraw/tldraw.css'
function Whiteboard() {
const handleMount = (app) => {};

// <Tldraw
// autofocus
// disableAssets=true
// showUI=false
// />`
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
prevelll = blog("index 5-10 hardware sellers like waveshare")
Insert cell
//render ar table from -prevcell
Insert cell
mutable firstPoint = 0
Insert cell
mutable lastPoint = 0
Insert cell
Insert cell
html`fristPoint lastpoint: ${firstPoint}, ${lastPoint}`
Insert cell
{
const canvas = DOM.canvas(500, 500);
const ctx = canvas.getContext("2d");
let firstPoint, lastPoint;
canvas.style.border = "biue 1px solid";
function calculateDirection(start, end) {
const deltaX = end.x - start.x;
const deltaY = end.y - start.y;
const radians = Math.atan2(deltaY, deltaX);
const degrees = radians * (180 / Math.PI);
return degrees;
}
let painting = false;

function startPosition(e) {
painting = true;
firstPoint = {
x: e.clientX - canvas.offsetLeft,
y: e.clientY - canvas.offsetTop
};

draw(e);
}

function endPosition() {
painting = false;
ctx.beginPath(); // Reset path

const direction = calculateDirection(firstPoint, lastPoint);
// window.direction = direction;
console.log("Direction from first to last point: " + direction);
}

function draw(e) {
if (!painting) return;
console.log("hi");
lastPoint = {
x: e.clientX - canvas.offsetLeft,
y: e.clientY - canvas.offsetTop
};

ctx.lineWidth = 5;
ctx.lineCap = "round";
ctx.strokeStyle = "blue";

ctx.lineTo(e.clientX - canvas.offsetLeft, e.clientY - canvas.offsetTop);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(e.clientX - canvas.offsetLeft, e.clientY - canvas.offsetTop);
}

// Mouse Events
canvas.addEventListener("mousedown", startPosition);
canvas.addEventListener("mouseup", endPosition);
canvas.addEventListener("mousemove", draw);

// Clear the canvas
function clearCanvas() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
}

// // Save canvas as an image
// function saveImage() {
// const link = document.createElement("a");
// link.download = "whiteboard.png";
// link.href = canvas
// .toDataURL("image/png")
// .replace("image/png", "image/octet-stream");
// link.click();
// }
yield canvas;
}
Insert cell
Insert cell
/*
This script provides a graphical interface to the digit recognition network.
*/
{
//var loadData = require('./common.js').loadData

let canvas = DOM.canvas(500, 500);
canvas.style.border = "1px solid blue";
// canvas.width = 1;
// canvas.height = 1;
// yield canvas;
// return canvas;
try {
// const regl = require("regl")({
// canvas: canvas,
// extensions: ["oes_texture_float"],
// onDone: function (err, regl) {
// if (err) {
// throw err;
// }
// }
// });
const loadData = function (cb) {
return cb({});
};

loadData(function (data) {
// var cnnGpu = require("./gpu.js")(regl, data);

// container for everything
// var container = document.createElement("div");
// container.style.cssText = "margin: 0 auto; max-width: 760px;"; // center text.
// container.style.fontWeight = "300"; // default font weight
// container.style.fontSize = "1.0em"; // default font size
// container.style.lineHeight = "1.6em"; // default line height
// container.style.fontFamily = "'Roboto',Helvetica,sans-serif";
// container.style.color = "#393939";
// var str =
// '<a href="https://github.com/Erkaman/regl-cnn/"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://camo.githubusercontent.com/82b228a3648bf44fc1163ef44c62fcc60081495e/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_left_red_aa0000.png"></a>';
// container.innerHTML = str;

// document.body.appendChild(container);

// h1 heder
// var par = document.createElement("h1");
// par.innerHTML = "GPU Deep Learning Demo";
// par.style.fontWeight = "400";
// par.style.fontSize = "2em";
// container.appendChild(par);

// paragraph
// par = document.createElement("p");
// par.innerHTML = [
// "Please draw a digit into this canvas.<br>",
// '(It will probably only work in Firefox and Chrome. And it may not work on mobile. It should look like <a href="http://imgur.com/gallery/AK0kN">this</a>)'
// ].join("\n");
// container.appendChild(par);

// create drawing canvas.
// canvas = document.createElement("canvas");
// canvas.width = 280;
// canvas.height = 280;
// canvas.style.borderWidth = 1;
// canvas.style.borderStyle = "solid";
// container.appendChild(canvas);
var ctx = canvas.getContext("2d");

// digit display div
// var digitPar = document.createElement("div");
// digitPar.innerHTML = "";
// digitPar.style.fontWeight = "800";
// digitPar.style.fontSize = "14em";
// digitPar.style.display = "inline";
// digitPar.style.marginLeft = "50px";
// container.appendChild(digitPar);

// var btnDiv = document.createElement("div");

// function createBtn() {
// var btn = document.createElement("button");
// btn.style.margin = "3px";
// btnDiv.appendChild(btn);

// return btn;
// }

// create buttons
// var btn = createBtn();
// btn.innerHTML = "Clear";
// btn.addEventListener(
// "click",
// function (e) {
// ctx.clearRect(0, 0, canvas.width, canvas.height);
// },
// false
// );
// btn = createBtn();
// btn.innerHTML = "Recognize";
// btn.addEventListener(
// "click",
// function (e) {
// recognize();
// },
// false
// );
//container.appendChild(btnDiv);

// h2 header
// par = document.createElement("h2");
// par.innerHTML = "How does this work?";
// par.style.fontWeight = "400";
// par.style.fontSize = "1.4em";
// container.appendChild(par);

// par = document.createElement("p");
// par.innerHTML = [
// "This demo does handwritten digit recognition by evaluating a Convolutional Neural Network on the GPU with WebGL.",
// 'The network was trained in TensorFlow <a href="https://github.com/Erkaman/regl-cnn/blob/gh-pages/scripts/create_cnn.py">by this script</a>, and the network was then reimplemented on the GPU by hand with WebGL.',
// "The main purpose of the demo was to demonstate how our WebGL framework",
// '<a href="https://github.com/mikolalysenko/regl">regl</a> can be used to greatly simplify GPGPU programming in WebGL.',
// "The secondary purpose was to test whether evaluating Deep Learning networks in WebGL is doable.",
// "To our knowledge, our implementation is the first implementation ever to attempt GPU accelerating neural networks with WebGL",
// "And we hope that this implementation will provide a foundation for people who, like us, wish to experiment with Deep Learning and WebGL",
// 'The GPU implementation can be found <a href="https://github.com/Erkaman/regl-cnn/blob/gh-pages/src/gpu.js">here</a>'
// ].join("\n");
// container.appendChild(par);

// add canvas listeners.
canvas.addEventListener(
"mousemove",
function (e) {
canvasListener("move", e);
},
false
);
canvas.addEventListener(
"mousedown",
function (e) {
canvasListener("down", e);
},
false
);
canvas.addEventListener(
"touchstart",
function (e) {
canvasListener("down", e);
},
false
);
canvas.addEventListener(
"touchend",
function (e) {
canvasListener("up", e);
},
false
);
canvas.addEventListener(
"touchmove",
function (e) {
canvasListener("move", e);
},
false
);
canvas.addEventListener(
"mouseup",
function (e) {
canvasListener("up", e);
},
false
);
canvas.addEventListener(
"mouseout",
function (e) {
canvasListener("out", e);
},
false
);

var lineWidth = 20;
var isMousedown = false;

function drawCircle(e) {
var x = e.pageX - canvas.offsetLeft;
var y = e.pageY - canvas.offsetTop;

ctx.beginPath();
ctx.lineWidth = 1;
ctx.arc(x, y, lineWidth / 2, 0, 2 * Math.PI);
ctx.stroke();
ctx.closePath();
ctx.fill();
}

function canvasListener(cmd, e) {
if (cmd === "down") {
isMousedown = true;
drawCircle(e);
} else if (cmd === "up") {
isMousedown = false;
} else if (cmd === "move" && isMousedown) {
drawCircle(e);
e.preventDefault(); // prevent any scrolling.
}
}

// computes center of mass of digit, for centering
// note 1 stands for black (0 white) so we have to invert.
function centerImage(img) {
var meanX = 0;
var meanY = 0;
var rows = img.length;
var columns = img[0].length;
var sumPixels = 0;

for (var y = 0; y < rows; y++) {
for (var x = 0; x < columns; x++) {
var pixel = 1 - img[y][x];
sumPixels += pixel;

meanY += y * pixel;
meanX += x * pixel;
}
}

meanX /= sumPixels;
meanY /= sumPixels;

var dY = Math.round(rows / 2 - meanY);
var dX = Math.round(columns / 2 - meanX);
return { transX: dX, transY: dY };
}

// given grayscale image, find bounding rectangle of digit defined
// by above-threshold surrounding
function getBoundingRectangle(img, threshold) {
var rows = img.length;
var columns = img[0].length;
var minX = columns;
var minY = rows;
var maxX = -1;
var maxY = -1;
for (var y = 0; y < rows; y++) {
for (var x = 0; x < columns; x++) {
if (img[y][x] < threshold) {
if (minX > x) minX = x;
if (maxX < x) maxX = x;
if (minY > y) minY = y;
if (maxY < y) maxY = y;
}
}
}
return { minY: minY, minX: minX, maxY: maxY, maxX: maxX };
}

// take canvas image and convert to grayscale. Mainly because my
// own functions operate easier on grayscale, but some stuff like
// resizing and translating is better done with the canvas functions
function imageDataToGrayscale(imgData) {
var grayscaleImg = [];
for (var y = 0; y < imgData.height; y++) {
grayscaleImg[y] = [];
for (var x = 0; x < imgData.width; x++) {
var offset = y * 4 * imgData.width + 4 * x;
var alpha = imgData.data[offset + 3];
// weird: when painting with stroke, alpha == 0 means white
// alpha > 0 is a grayscale value in that case I simply take the R value
if (alpha === 0) {
imgData.data[offset + 0] = 255;
imgData.data[offset + 1] = 255;
imgData.data[offset + 2] = 255;
}
imgData.data[offset + 3] = 255;
// simply take red channel value. Not correct, but works for
// black or white images.
grayscaleImg[y][x] =
imgData.data[y * 4 * imgData.width + x * 4 + 0] / 255;
}
}
return grayscaleImg;
}

function recognize() {
// NOTE: We need to correctly center and downscale the image before we can feed it to the network.
// The below code for doing that is not my code, but is MIT-licensed code adapted from this demo:
// http://myselph.de/neuralNet.html
// convert RGBA image to a grayscale array, then compute bounding rectangle and center of mass
// var imgData = ctx.getImageData(0, 0, 280, 280);
// var grayscaleImg = imageDataToGrayscale(imgData);
// var boundingRectangle = getBoundingRectangle(grayscaleImg, 0.01);
// // console.log('boundingRectangle ', boundingRectangle)
// var trans = centerImage(grayscaleImg); // [dX, dY] to center of mass
// console.log('trans ', trans)
// copy image to hidden canvas, translate to center-of-mass, then
// scale to fit into a 200x200 box (see MNIST calibration notes on
// Yann LeCun's website)
// var canvasCopy = document.createElement("canvas");
// canvasCopy.width = imgData.width;
// canvasCopy.height = imgData.height;
// var copyCtx = canvasCopy.getContext("2d");
// var brW = boundingRectangle.maxX + 1 - boundingRectangle.minX;
// var brH = boundingRectangle.maxY + 1 - boundingRectangle.minY;
// var scaling = 190 / (brW > brH ? brW : brH);
// // scale
// copyCtx.translate(canvas.width / 2, canvas.height / 2);
// copyCtx.scale(scaling, scaling);
// copyCtx.translate(-canvas.width / 2, -canvas.height / 2);
// // translate to center of mass
// copyCtx.translate(trans.transX, trans.transY);
// // default take image from original canvas
// copyCtx.drawImage(ctx.canvas, 0, 0);
// // now bin image into 10x10 blocks (giving a 28x28 image)
// imgData = copyCtx.getImageData(0, 0, 280, 280);
// grayscaleImg = imageDataToGrayscale(imgData);
// var nnInput = new Array(784);
// for (var y = 0; y < 28; y++) {
// for (var x = 0; x < 28; x++) {
// var mean = 0;
// for (var v = 0; v < 10; v++) {
// for (var h = 0; h < 10; h++) {
// mean += grayscaleImg[y * 10 + v][x * 10 + h];
// }
// }
// mean = 1 - mean / 100; // average and invert
// nnInput[x + y * 28] = mean;
// }
// }
// after we have processed the canvas, we can actually run the network now:
//var res = cnnGpu(nnInput);
//console.log("result: ", res);
// output result to HTML
//var actual = res.indexOf(Math.max.apply(null, res));
// digitPar.innerHTML = actual + "";
}
});
} catch (e) {
// document.body.innerHTML =
// "Failed to initialize the demo because:</br></br><code>" +
// e +
// "</code></br></br>" +
// '<a href="https://github.com/Erkaman/regl-cnn">But you can find a recorded gif of the demo by clicking here.</a>';
}
yield canvas;
//hand writing - to bot
}
Insert cell
first_vis = {
// Create a shared filter
const $filter = vg.Selection.crossfilter();

// Shared attributes for the maps
const attributes = [
vg.width(315),
vg.height(550),
vg.margin(0),
vg.xAxis(null),
vg.yAxis(null),
vg.xDomain([297000, 297000 + 28.36 * 315]),
vg.yDomain([57900, 57900 + 28.36 * 550]), // ensure aspect ratio of 1
vg.colorScale("symlog")
];

// Create two side-by-side maps
const maps = vg.hconcat(
vg.plot(
vg.raster(vg.from("trips", { filterBy: $filter }), {
x: "px",
y: "py",
imageRendering: "pixelated"
}),
vg.intervalXY({ as: $filter }),
vg.text([{ label: "Taxi pickups" }], {
dx: 10,
dy: 10,
text: "label",
fill: "white",
frameAnchor: "top-left"
}),
...attributes,
vg.colorScheme("turbo"),
vg.frame({ stroke: "black" })
),
vg.hspace(10),
vg.plot(
vg.raster(vg.from("trips", { filterBy: $filter }), {
x: "dx",
y: "dy",
imageRendering: "pixelated"
}),
vg.intervalXY({ as: $filter }),
vg.text([{ label: "Taxi dropoffs" }], {
dx: 10,
dy: 10,
text: "label",
fill: "white",
frameAnchor: "top-left"
}),
...attributes,
vg.colorScheme("turbo"),
vg.frame({ stroke: "black" })
)
);

// Create the histogram
const histogram = vg.plot(
vg.rectY(vg.from("trips"), {
x: vg.bin("time"),
y: vg.count(),
insetLeft: 0.5,
insetRight: 0.5
}),
vg.intervalX({ as: $filter }),
vg.yTickFormat("s"),
vg.xLabel("Hour of pickup"),
vg.yLabel("Number of rides"),
vg.width(640),
vg.height(100)
);
}
Insert cell
Insert cell
Insert cell
Insert cell
/// impport a demo ---- pass through (3 steps) -> add sliders + voice to add sliders()
Insert cell
Insert cell
Insert cell
blog = (message) => d3.json("https://hashirama.blog//llama-backend/, {message})
Insert cell
import { _canvas } from "@roboticsuniversity/three-js-canvas"
Insert cell
_canvas
Insert cell
do_things
Insert cell
import { do_things } from "@roboticsuniversity/three-js-canvas"
Insert cell
//https://www.rescuetime.com/dashboard -import API and diff with
Insert cell
base_route = `https://shels-macbook-pro.jerboa-kokanue.ts.net/`
Insert cell
html`<iframe height="1920" width="1920" src="https://xtermjs.org/"/></iframe>`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//https://www.classcentral.com/course/statics1-564
Insert cell
{
return {
"Introduction to Robotic Systems": {
"1.1": "Overview of robotic systems and their applications",
"1.2": "Fundamentals of robotics and automation",
"1.3": "Introduction to robotic design principles"
},
"Mechanical Arm Design": {
"2.1": "Kinematics and dynamics of robotic arms",
"2.2": "Mechanical design considerations for robotic arms",
"2.3": "Actuators and transmission systems for robotic arms",
"2.4": "Case studies and examples of robotic arm designs"
},
"Mechanical Finger Design": {
"3.1": "Anatomy and biomechanics of human fingers",
"3.2": "Design principles for robotic fingers",
"3.3": "Actuation and control systems for robotic fingers",
"3.4": "Grasping and manipulation strategies for robotic fingers"
},
"Robotic Locomotion": {
"4.1": "Overview of robotic locomotion techniques",
"4.2": "Wheeled and tracked locomotion systems",
"4.3": "Legged locomotion systems",
"4.4": "Bioinspired and hybrid locomotion systems"
},
"Sensor Design for Robotics": {
"5.1": "Introduction to sensors in robotic systems",
"5.2": "Proprioceptive sensors (encoders, potentiometers, etc.)",
"5.3": "Exteroceptive sensors (vision, tactile, proximity, etc.)",
"5.4": "Sensor fusion and integration in robotic systems"
},
"Robotic Control Systems": {
"6.1": "Introduction to robotic control architectures",
"6.2": "Motion planning and trajectory generation",
"6.3": "Feedback control systems for robotics",
"6.4": "Advanced control techniques (adaptive, robust, learning-based)"
},
"Robotic Perception and Computer Vision": {
"7.1": "Introduction to robotic perception",
"7.2": "Image processing techniques for robotics",
"7.3": "Object detection and recognition in robotic systems",
"7.4": "3D vision and point cloud processing"
},
"Robotic Grasping and Manipulation": {
"8.1": "Grasping theory and taxonomy",
"8.2": "Grasp planning and optimization",
"8.3": "Dexterous manipulation and in-hand manipulation",
"8.4": "Collaborative manipulation and human-robot interaction"
},
"Robotic Navigation and Mapping": {
"9.1": "Introduction to robotic navigation",
"9.2": "Localization and mapping techniques (SLAM)",
"9.3": "Path planning and obstacle avoidance",
"9.4": "Autonomous navigation in complex environments"
},
"Robotic Learning and Adaptation": {
"10.1": "Introduction to machine learning for robotics",
"10.2": "Supervised learning techniques for robotic systems",
"10.3": "Reinforcement learning for robotic control",
"10.4": "Transfer learning and domain adaptation in robotics"
},
"Robotic Simulation and Prototyping": {
"11.1": "Introduction to robotic simulation tools",
"11.2": "Physics-based simulation for robotic systems",
"11.3": "Rapid prototyping techniques for robotics",
"11.4": "Hardware-in-the-loop simulation and testing"
},
"Robotic Ethics and Safety": {
"12.1": "Ethical considerations in robotic design and deployment",
"12.2": "Safety standards and regulations for robotic systems",
"12.3": "Risk assessment and mitigation strategies",
"12.4": "Human-robot interaction safety and trust"
},
"Future Trends and Applications in Robotics": {
"13.1":
"Emerging technologies in robotics (soft robotics, micro-robotics, etc.)",
"13.2": "Robotics in manufacturing and industry",
"13.3": "Robotics in healthcare and assistive technologies",
"13.4": "Space and underwater robotics applications"
}
};
}
Insert cell
Insert cell
Insert cell
viewof table = Inputs.table(nanosaur_BOM)
Insert cell
parse_price = function parse_price(str) {
// Parse function using d3 to extract floating point numbers
function extractNumbers(input) {
// Use regular expression to match any floating-point numbers
let numbers = input.match(/(\d+\.\d+|\d+)/g);

return numbers;
}

// Call the function
let parsedResult = extractNumbers(str);

return parsedResult;
}
Insert cell
{
const sum = nanosaur_total_costs.reduce(
(a, b) => parseFloat(a) + parseFloat(b),
0
);
return Math.round(sum * 100) / 100;
}
Insert cell
nanosaur_total_costs = nanosaur_BOM
.map((_) => _.USA)
.map((_) => _.split(" ")[0])
.map(parse_price)
.map((_) => parseFloat(_))
.filter((_) => _)
Insert cell
nanosaur_BOM = {
const bom = [
{
Qt: 1,
Part: "NVIDIA Jetson Nano",
USA: "$118 Amazon",
Italy: "",
UK: "",
Netherlands:
"https://www.amazon.com/gp/product/B0C5DMKFYW/ref=ox_sc_act_title_1?smid=A50C560NZEBBE&psc=1",
Notes:
"You can use 2Gb or 4Gb version. Buy this alternative carrier: SEEED studio"
},
{
Qt: 1,
Part: "MicroSD card 64Gb",
USA: "$9.99 Amazon",
Italy: "Amazon",
UK: "Amazon",
Netherlands: "Amazon",
Notes: ""
},
{
Qt: 1,
Part: "128GB NVM3 M.2 PCLe SSD",
USA: "0",
Italy: "",
UK: "",
Netherlands: "",
Note_eggnog: "not really needed but cool",
Notes: "Only for SEEED STUDIO carrier, NVMe M.2"
},
{
Qt: 1,
Part: "Wi-Fi Dongle 5Ghz",
USA: "$13.90 Amazon",
Italy: "Amazon",
UK: "Amazon",
Netherlands: "Amazon",
Notes: ""
},
{
Qt: 1,
Part: "Power Bank",
USA: "$29.99 Amazon",
Italy: "Amazon",
UK: "Amazon",
Netherlands: "Amazon",
Notes: "Power Bank dimensioning"
},
{
Qt: 2,
Part: "Pololu Micro Gearbox",
USA: "$25.75 Amazon",
Italy: "Amazon",
UK: "Amazon",
Netherlands: "Amazon",
Notes: "Pololu 6V 150RPM alternative: aliexpress.com"
},
{
Qt: 1,
Part: "Adafruit motor control",
USA: "$29.10 Amazon",
Italy: "Amazon",
UK: "Amazon",
Netherlands: "Amazon",
Notes: "DC Motor + Stepper FeatherWing Add-on alternative: aliexpress.com"
},
{
Qt: 2,
Part: "oled display",
USA: "$5 Amazon",
Italy: "Amazon",
UK: "Amazon",
Netherlands: "Amazon",
Notes: "128x64px 0.06in I2C, Best price pack: 3 display"
},
{
Qt: 6,
Part: "Ball bearings F686ZZ",
USA: "$7.49 Amazon",
Italy: "Amazon",
UK: "Amazon",
Netherlands: "Amazon",
Notes: "alternative: aliexpress.com"
},
{
Qt: 10,
Part: "Magnets 4x2mm",
USA: "$10.99 Amazon",
Italy: "",
UK: "",
Netherlands: "Amazon",
Notes: "alternative: aliexpress.com"
},
{
Qt: "-",
Part: "Expansion board",
USA: "",
Italy: "",
UK: "",
Netherlands: "",
Notes: "Expansion board"
},
{
Qt: "-",
Part: "3D parts",
USA: "",
Italy: "",
UK: "",
Netherlands: "",
Notes: "3D filaments"
},
{
Qt: "-",
Part: "Hex M2 Screw set",
USA: "$10* Amazon",
Italy: "",
UK: "",
Netherlands: "",
Notes: "Screw set"
}
];
return bom;
}
Insert cell
Insert cell
Insert cell
html`you dont pass butter - you build miniature dynamiclands

dynamicland.org = Vision transformer + projection mapping -> could be $500 - but realtalkLang by worrydream = 100T easy bc it solves the problems of "biycle of the mind" - (singeplayer game)


dynamicland = multiplayer -> cooperative
`
Insert cell
Off_by_50Percent = FileAttachment(
"Screenshot 2024-10-18 at 11.33.22 AM.png"
).image()
Insert cell
# ------ Visual Terminal ---- Ghostty - webgpu --- has a obs compoennt - tesxt-Animation - dalle+ w/e
Insert cell
html`<svg width="600" height="400">
<g transform="translate(50, 350)">
<line x1="0" y1="0" x2="0" y2="-150" stroke="black" stroke-width="2"/>
<line x1="0" y1="0" x2="50" y2="0" stroke="black" stroke-width="2"/>
<line x1="50" y1="0" x2="50" y2="-30" stroke="black" stroke-width="2"/>
<line x1="50" y1="-30" x2="100" y2="-30" stroke="black" stroke-width="2"/>
<line x1="100" y1="-30" x2="100" y2="-75" stroke="black" stroke-width="2"/>
<line x1="100" y1="-75" x2="150" y2="-75" stroke="black" stroke-width="2"/>
<line x1="150" y1="-75" x2="150" y2="-150" stroke="black" stroke-width="2"/>
<line x1="150" y1="-150" x2="250" y2="-150" stroke="black" stroke-width="2"/>
<line x1="250" y1="-150" x2="250" y2="-250" stroke="black" stroke-width="2"/>
<line x1="250" y1="-250" x2="500" y2="-250" stroke="black" stroke-width="2"/>
</g>
<text x="20" y="370" font-size="14">5k</text>
<text x="70" y="370" font-size="14">10k</text>
<text x="120" y="370" font-size="14">15k</text>
<text x="170" y="370" font-size="14">25k</text>
<text x="220" y="370" font-size="14">50k</text>
<text x="320" y="370" font-size="14">100k</text>
<text x="450" y="370" font-size="14">250k</text>
</svg>`
Insert cell
components_for_nanosaur_factory = {
//lighttable.com
//voice to chatbot -> keybinds for reformatting into code - template / ctags
return {
"5k": 0,
"10k": 0,
"15k": 0,
"25k": 0,
"50k": 0,
"100k": 0,
"250k": 0
};
}
Insert cell
total_price_for_components_for_nanosaur_factory = {
return Object.keys(components_for_nanosaur_factory).map((_) =>
parseFloat(_.split("k")[0])
);
//see above the maze - 3d perspective ----------> dalle but slider+2 camera - VV
//KPIS - signups + hardware learned
//find things like mozilla fellowship
//https://chatgpt.com/share/67152128-8938-8013-a74f-84d044e75d40
//index this + dynamcland first (https://nanosaur.ai/) -> alankay -> citations.txt
}
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more