Skip to content

Commit

Permalink
cool beans
Browse files Browse the repository at this point in the history
  • Loading branch information
adnanwahab committed Oct 21, 2024
1 parent 0f9397a commit 35af9dc
Show file tree
Hide file tree
Showing 12 changed files with 1,345 additions and 37 deletions.
1 change: 1 addition & 0 deletions citations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,4 @@ https://jetsonhacks.com/2023/05/30/jetson-orin-nano-tutorial-ssd-install-boot-an
https://web.archive.org/web/20191125073329/http://alexsharry.com/ - {reflect.app}

https://edu.irobot.com/what-we-offer/create3
https://blog.gregbrockman.com/
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 10-environmental-challenges-and-solutions-for-sensor-deployment

Content for 10-environmental-challenges-and-solutions-for-sensor-deployment
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 8-integrating-sensors-with-machine-learning-on-edge-devices

Content for 8-integrating-sensors-with-machine-learning-on-edge-devices
973 changes: 973 additions & 0 deletions web-ui/docs/blag/iindex.html

Large diffs are not rendered by default.

152 changes: 152 additions & 0 deletions web-ui/docs/blag/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# Best Of
1. Making RObotics odyssey: robot to feed cats
2. Making Llama-tools
3. Functional reactive infrastructure
# Introduction to Sensors
1. What are Sensors and Their Applications in Robotics
2. Types of Sensors Used in Robotics: From Proximity to LIDAR
3. How to Interface Sensors with Jetson Modules
4. Choosing the Right Sensors for Your Robotics Project
5. Top 10 Affordable Sensors for Hobbyists
6. Sensor Fusion Techniques for Reliable Robotics Applications
7. Using Zig to Manage Sensor Data in Real-Time Systems
8. Integrating Sensors with Machine Learning on Edge Devices
9. Best Practices for Calibration and Maintenance of Sensors
10. Environmental Challenges and Solutions for Sensor Deployment

# NVIDIA Jetson Series

1. Getting Started with NVIDIA Jetson Nano for Robotics
2. Differences Between Jetson Nano, Xavier, and Orin Explained
3. Setting Up a Robotics Development Environment on Jetson
4. Running AI Models on Jetson Devices with PyTorch
5. Jetson as an Edge Device for Distributed Computing in Swarms
6. Using Zig for Efficient Device Control on Jetson Boards
7. Comparing Jetson Xavier NX with Raspberry Pi for Vision Tasks
8. Deep Learning with Jetson: A Practical Guide
9. Building ROS-Based Robots with Jetson Orin
10. Jetson as a Brain for Autonomous Mobile Robots

# Robotic Arms

1. Building a Low-Cost Robotic Arm with Dynamixel Servos
2. Robotic Arm Kinematics Explained: From Math to Implementation
3. 3D Printed Robotic Arms: Design and Limitations
4. Programming Robotic Arm Movements with ROS
5. Integrating Robotic Arms with Jetson for Machine Learning Applications
6. Using Zig to Optimize Robotic Arm Control Loops
7. Selecting Servo Motors for Your Robotic Arm Project
8. Collaborative Robots: Designing a User-Friendly Arm
9. Precision Control for Robotic Arms in Manufacturing
10. DIY Projects: Assembling a Robotic Arm Under $500

Locomotion and Mobility Systems

1. An Overview of Locomotion Types: Wheels, Legs, and Tracks
2. Creating a Bipedal Robot: Challenges and Solutions
3. Balancing Algorithms for Two-Wheeled Robots
4. Mobile Robotics with Jetson: Mapping and Navigation
5. Integration of Sensor Data for Autonomous Locomotion
6. Zig for Writing Efficient Motion Control Programs
7. Choosing the Right Wheels and Motors for Your Robot
8. Designing a Modular Locomotion System for Versatility
9. Swarm Robotics and Locomotion Synchronization Techniques
10. Robotics Locomotion in Rough Terrain: Challenges and Strategies

3D Printing for Robotics

1. Designing 3D-Printed Parts for Robotics Projects
2. Best 3D Printers for Robotic Prototyping
3. Materials for 3D Printing Robotic Components: PLA vs. ABS
4. Printing Jigs and Fixtures for Assembling Robots
5. Integrating 3D-Printed Parts with Off-the-Shelf Electronics
6. Customizing Robotic Arm Components Using 3D Printing
7. Common Issues with 3D Printed Parts and How to Fix Them
8. Combining 3D Printing with CNC Machining for Precision
9. 3D Printing Gears for Robotic Applications: Tips and Tricks
10. Designing Lightweight Yet Strong Robotic Components

Zig for Systems Engineering

1. Why Use Zig for Systems-Level Robotics Programming?
2. Getting Started with Zig for Hardware Control
3. Comparing Zig to C/C++ for Robotics Projects
4. Writing Low-Latency Sensor Drivers in Zig
5. Memory Safety in Zig: Advantages for Robotics Systems
6. Using Zig to Interface with Real-Time Operating Systems
7. Building Modular Robotics Software Architectures in Zig
8. Code Examples: Interfacing Motors with Zig
9. Best Practices for Zig in Embedded Systems
10. Debugging Robotics Applications Written in Zig

Introduction to LlamaOps

1. What is LlamaOps and How Does It Work?
2. Llama Models Explained: From GPT to Llama 3
3. Deploying Llama Models on Local Servers vs. Cloud
4. Training Llama Models for Robotics Applications
5. Optimizing Llama Inference for Real-Time Systems
6. Using LlamaOps for Conversational AI in Robotics
7. Comparing Llama with GPT-4 for Technical Applications
8. Hosting Llama Models with Docker and Kubernetes
9. Privacy Concerns in Using Llama for On-Device AI
10. Fine-Tuning Llama Models for Niche Applications

Llama Model Training and Deployment

1. How to Train Llama Models with Custom Datasets
2. Understanding the Compute Requirements for Llama Training
3. Using Jetson Devices to Run Llama Inference Efficiently
4. Quantization Techniques to Optimize Llama Models
5. Comparing Llama and BERT for Domain-Specific Tasks
6. Hosting a Llama API for Your Robotics Project
7. Using Zig with LlamaOps for Low-Level Optimizations
8. Combining Llama Models with OpenCV for Object Detection
9. Model Evaluation Metrics for Llama in Robotics Contexts
10. Deploying Llama on Edge Devices for Offline Use

Llama for Robotics

1. Voice-Controlled Robotics Using Llama-Based NLP
2. LlamaOps in Human-Robot Interaction Scenarios
3. Integrating LlamaOps with ROS for Seamless Operation
4. Creating an AI Chatbot for Your Robot with LlamaOps
5. Using Llama for Fault Diagnosis in Autonomous Systems
6. Exploring Multi-Agent Communication with LlamaOps
7. Generating Movement Commands with Llama Language Models
8. LlamaOps for Knowledge Sharing Among Robot Swarms
9. Comparing Llama with Traditional ML for Command Execution
10. Using Reinforcement Learning with Llama Models in Robotics

Introduction to Computer Vision

1. Basics of Computer Vision for Robotics Beginners
2. Setting Up OpenCV on Jetson Devices
3. How Computer Vision Powers Robotics Today
4. Key Algorithms in Computer Vision: A Beginner’s Guide
5. Using YOLO for Object Detection in Robotics
6. Deep Learning Models for Computer Vision Tasks
7. Camera Calibration for Accurate Computer Vision
8. Combining Computer Vision with Llama for Perception
9. Evaluating Object Recognition Models for Robotics
10. Edge vs. Cloud: Where to Deploy Computer Vision Models

Advanced Computer Vision Techniques

1. Training Your Own Computer Vision Model with PyTorch
2. Using GANs for Image Synthesis in Robotics Applications
3. Segmentation Techniques in Robotics Using SAM
4. Real-Time Image Processing for Mobile Robots
5. Depth Estimation for 3D Perception in Robots
6. Using Zig for Optimizing Vision Algorithms on Edge Devices
7. Combining Lidar and Camera Data for Better Vision
8. Object Tracking Techniques for Robotic Applications
9. Using CUDA to Speed Up Vision Processing
10. Evaluating SLAM Algorithms for Visual Localization
Advanced Computer Graphics Techniques
1. NERF
2. Gaussian Splatting
3. Point Cloud Rendering
4. Voxels and Stixels
5. Server Side WebGPU Streaming
6. Ray Tracing (2D and 3D) - Visibility
3 changes: 3 additions & 0 deletions web-ui/docs/making-llama-tools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# making-llama-tools

Content for making-llama-tools
3 changes: 3 additions & 0 deletions web-ui/docs/making-robotics-odyssey-robot-to-feed-cats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# making-robotics-odyssey-robot-to-feed-cats

Content for making-robotics-odyssey-robot-to-feed-cats
3 changes: 3 additions & 0 deletions web-ui/docs/nvidia-jetson-series.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# nvidia-jetson-series

Content for nvidia-jetson-series
150 changes: 115 additions & 35 deletions web-ui/js/bun-helper-server.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const ollama = require('ollama');
import {$} from 'bun'
import { renderToString } from "react-dom/server";
import React, { Suspense, lazy } from 'react';
import Bun from 'bun'
Expand All @@ -7,6 +9,7 @@ import { connect_to_livekit } from './bun_handlers/bun-livekit-server.js'
import llamaRoutes from './bun_handlers/llama-backend.js'
import CgiRoutes from './bun_handlers/cgi-backend.js'
import { renderToReadableStream } from 'react-dom/server';
import TurndownService from 'turndown';

const port = 8080;
console.log(`Server running at http://localhost:${port}`);
Expand Down Expand Up @@ -77,53 +80,83 @@ function serveBlag(req: Request) {
});
}

function on_save_blag(req: Request) {
ollama.generate({
model: "llama3.2",
prompt: "predict if there are errors before running thiss"
})
//run thing
ollama.generate({
//model: "llama3.2",
model: "llama3.2",
prompt: "if errors - suggest fixes"
})
}

async function serveBlagArchive(req: Request) {
const url = `https://reflect.site/g/awahab/500-blog-posts---prolific---show-steps---12yr-exec--phd-x-7-in-2-yrs/d1ea069679c64f649827dd990648b17c`
const response = await fetch(url);
const htmlContent = await response.text();
try {
const filePath = path.join(process.cwd(), "docs/blag/index.md");
// console.log('filePath', filePath);
// const htmlContent = fs.readFileSync(filePath, "utf-8");

const turndownService = new TurndownService();
const markdownContent = turndownService.turndown(htmlContent);
const lines = markdownContent.split('\n');
// async function convertHtmlToMarkdown(htmlContent) {
// const ask_ollama = async (prompt) => {
// const proc = Bun.spawn(["ollama", "run", "llama3.2", "prompt", prompt]);
// const output = await new Response(proc.stdout).text();
// return output;
// };

// const prompt = "Convert the following HTML content to Markdown:\n\n" + htmlContent;

const docsPath = path.join(process.cwd(), 'docs');
if (!fs.existsSync(docsPath)) {
fs.mkdirSync(docsPath, { recursive: true });
}
// const markdownContent = await ask_ollama(prompt);
// return markdownContent;
// }

lines.forEach(line => {
if (line.startsWith('#')) {
const header = line.replace(/#/g, '').trim();
const folderName = header.replace(/\s+/g, '-');
const folderPath = path.join(docsPath, folderName);
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath, { recursive: true });
}
const markdownContent = fs.readFileSync(filePath, "utf-8");
//console.log('markdownContent', markdownContent);

//const lines = markdownContent.split('\n');

// Create an HTML file in the folder with the title
const htmlContent = `<html><head><title>${header}</title></head><body><h1>${header}</h1></body></html>`;
const filePath = path.join(folderPath, `${folderName}.html`);
fs.writeFileSync(filePath, htmlContent, 'utf-8');
//console.log('lines', lines);;

//immutable functional reactive infra -> on save -> refresh + replit but faster - tailwind 4 robots
const lines = markdownContent.split('\n')


const docsPath = path.join(process.cwd(), 'docs');
if (!fs.existsSync(docsPath)) {
fs.mkdirSync(docsPath, { recursive: true });
}
});

const content = `${lines.map((line, i) => {
let content = '<ul>';
for (let i = 0; i < 500; i++) {
const randomLink = `https://example.com/${Math.random()}`;
content += `<li><a href="${randomLink}">Link ${i + 1}</a></li>`;
}
content += '</ul>';
if (line.startsWith('#')) {
return `<h1>${line.slice(2)}</h1>`;
}
return new Response(content, {
headers: {
"Content-Type": "text/html",
},
});
const cleanedLine = line.slice(3).replace(/[^a-zA-Z0-9\s-]/g, '').trim();
if (cleanedLine === ' ') {
return '';
}
return new Response('blag archive')
const simplifiedLink = cleanedLine.replace(/\s+/g, '-').toLowerCase();
return `<div><a href="blag/${simplifiedLink}">${cleanedLine}</a></div>`;
}).join('<br/>')}`;

return new Response(content, {
headers: {
"Content-Type": "text/html",
},
});
} catch (error) {
console.error('Error in serveBlagArchive:', error);
return new Response('An error occurred while processing your request', { status: 500 });
}
}

const CgiRoutesHandlers = Object.fromEntries(
Expand All @@ -142,6 +175,9 @@ const routes = {
"/blag": (req: Request) => serveBlag(req),
"/llama-tools": (req: Request) => serveLlamaTools(req),
"/cgi-tools": (req: Request) => serveCgiTools(req),



"/blag-archive": (req: Request) => serveBlagArchive(req),

...CgiRoutesHandlers,
Expand All @@ -159,6 +195,47 @@ main();

async function fetch(req: Request) {
const url = new URL(req.url);

if (!req.url) {
console.error('Request URL is undefined');
return new Response('Invalid request', { status: 400 });
}
if (url.pathname.startsWith("/blag/")) {
const route = url.pathname.replace("/blag/", "");
const filePath = `./docs/${route}.md`;
try {
await Bun.write(filePath, `# ${route}\n\nContent for ${route}`);
const fileExists = await Bun.file(filePath).exists();
if (fileExists) {
return new Response(await Bun.file(filePath).text(), { status: 200 });
} else {
const prompt = `Generate a paragraph of PhD level content and 10 citations related to the topic described in the file: ${filePath}`;

const response = await ollama.chat({
model: 'llama3.1',
messages: [{ role: 'user', content: prompt }],
})

const generatedContent = await response.message.content;
const content = generatedContent.text;

await Bun.write(filePath, content);
return new Response(content, { status: 200 });



}


//return new Response(`File created at ${filePath}`, { status: 201 });
} catch (error) {
console.error('Error creating file:', error);
return new Response('An error occurred while creating the file', { status: 500 });
}
}



console.log('url', url.pathname)
if (url.pathname.startsWith("/assets")) return Bun.file('/Users/shelbernstein/homelab_status_page/web-ui/assets/output.css')

Expand Down Expand Up @@ -352,3 +429,6 @@ function makeReactApp(component_name) {
// }

//import RoboticsOdyssey from "views/odyssey/robotics-odyssey.tsx";



Loading

0 comments on commit 35af9dc

Please sign in to comment.