### Local Project Setup and Execution (Bash)
Source: https://context7.com/middlefingerapp/cyberpunksysmon_versionc/llms.txt
Provides instructions for cloning the project repository and running it locally. It covers cloning the repo using git, navigating into the project directory, and serving the application using Python's built-in HTTP server.
```bash
# Clone the repository
git clone https://github.com/middlefingerapp/CyberpunkSysMon_versionC.git
# Navigate to directory
cd CyberpunkSysMon_versionC
# Open in browser (macOS)
open index.html
# Or serve with any static server
python -m http.server 8000
# Then visit http://localhost:8000
```
--------------------------------
### Initialize System Monitoring Variables and Constants
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C3.html
Defines constants for colors and initializes state variables for FPS tracking. It also sets the system start time for uptime calculations.
```javascript
const COLORS = { bg: '#000000', cyan: '#8be9fd', pink: '#ff79c6', purple: '#bd93f9', green: '#50fa7b', alert: '#ff5555' }; // FPS
const fpsState = { fps: 60, frameCount: 0, lastTime: performance.now() }; // System uptime tracking
const systemStartTime = Date.now();
```
--------------------------------
### Initialize CPU Usage Bars (JavaScript)
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C1.html
Generates the HTML structure for displaying CPU core usage. It creates a set of 'pip' elements for each core, representing usage levels. Each core gets a label and a track containing 20 pips.
```javascript
initCpuBars() { let html = ''; for(let i=0; i < 8; i++) { // Create 20 pips per core const pips = Array(20).fill('
').join(''); html += ` `; } this.dom.cpuContainer.innerHTML = html;
```
--------------------------------
### Process Manager Initialization (JavaScript)
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C1.html
Initializes the Process Manager, setting up DOM element references for the process list table body and the log feed. It then starts interval timers to periodically update the process list and add new log entries.
```javascript
constructor() { this.dom = { tableBody: document.getElementById('proc-list'), logFeed: document.getElementById('log-feed') }; this.init(); }
init() { this.updateProcesses(); setInterval(() => this.updateProcesses(), Config.UpdateRates.process); setInterval(() => this.addLogEntry(), Config.UpdateRates.logs);
```
--------------------------------
### MechRenderer Class for 3D Visualization (JavaScript)
Source: https://context7.com/middlefingerapp/cyberpunksysmon_versionc/llms.txt
Implements a 3D visualization engine using Three.js to create and animate a rotating wireframe icosahedron. It handles scene setup, camera, renderer, and mesh creation, and includes a continuous animation loop. This class requires Three.js to be loaded.
```javascript
class MechRenderer {
constructor(containerId, canvasId) {
this.container = document.getElementById(containerId);
this.canvas = document.getElementById(canvasId);
this.scene = new THREE.Scene();
this.scene.background = new THREE.Color('#000000');
// Camera setup
const aspect = this.container.clientWidth / this.container.clientHeight;
this.camera = new THREE.PerspectiveCamera(50, aspect, 0.1, 1000);
this.camera.position.z = 5;
// Renderer setup
this.renderer = new THREE.WebGLRenderer({
canvas: this.canvas,
alpha: true,
antialias: true
});
// Wireframe mesh
const geometry = new THREE.IcosahedronGeometry(1.5, 0);
const material = new THREE.MeshBasicMaterial({
color: '#8be9fd',
wireframe: true
});
this.mesh = new THREE.Mesh(geometry, material);
this.scene.add(this.mesh);
this.animate();
}
animate() {
requestAnimationFrame(() => this.animate());
this.mesh.rotation.y += 0.01;
this.renderer.render(this.scene, this.camera);
}
}
// Usage
new MechRenderer('viewport-3d', 'mech-canvas');
```
--------------------------------
### Telemetry Module for CPU and Memory (JavaScript)
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C2.html
The TelemetryModule class monitors and displays CPU core usage, voltage, temperature, and memory statistics. It initializes by rendering empty bars for CPU cores and starts an update interval. It uses DOM elements for displaying values and bars, and `navigator.hardwareConcurrency` for core count.
```javascript
class TelemetryModule {
constructor() {
this.elContainer = document.getElementById('cpu-bars');
this.elCores = document.getElementById('cpu-cores-telem');
this.elVolt = document.getElementById('cpu-volt');
this.elTemp = document.getElementById('cpu-temp-telem');
this.elMemUsed = document.getElementById('mem-used');
this.elMemTotal = document.getElementById('mem-total');
this.elRamBar = document.getElementById('ram-bar');
this.coreCount = navigator.hardwareConcurrency || 4;
this.init();
}
init() {
this.elCores.textContent = this.coreCount;
// Render empty bars
let html = '';
for(let i=0; i<4; i++) {
html += ` CORE_0${i} 0%
`;
}
this.elContainer.innerHTML = html;
// Start simulation
setInterval(() => this.update(), CONFIG.refresh.cpu);
}
update() {
// Update Cores
const baseLoad = Utils.rand(10, 30);
for(let i=0; i<4; i++) {
const load = Math.min(100, baseLoad + Utils.rand(0, 30));
const elBar = document.getElementById(`core-bar-${i}`);
const elVal = document.getElementById(`core-val-${i}`);
if(elBar) elBar.style.width = `${load}%`;
if(elVal) elVal.textContent = `${Math.floor(load)}%`;
}
// Update Env stats
const temp = 35 + Utils.rand(0, 20);
this.elTemp.textContent = `${Math.floor(temp)}°C`;
this.elTemp.className = temp > 50 ? "stat-val text-pink" : "stat-val text-green";
this.elVolt.textContent = (1.1 + Utils.rand(0, 0.2)).toFixed(2) + 'V';
// Update Memory
let used = (window.performance && performance.memory) ? Math.round(performance.memory.usedJSHeapSize / 1048576) : 400 + Utils.randInt(0, 200);
const total = navigator.deviceMemory || 8;
this.elMemUsed.textContent = used;
this.elMemTotal.textContent = total;
const pct = Math.min(100, (used / (total * 1024)) * 100);
this.elRamBar.style.width = `${pct}%`;
}
}
```
--------------------------------
### Set Up and Simulate CPU Telemetry
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C3.html
The `setupCPUTelemetry` function initializes the display for CPU core count and generates HTML for CPU load bars. It then uses `setInterval` to simulate CPU activity, updating the width and text of CPU load bars, CPU temperature, and memory usage. It also updates the memory usage percentage based on available browser memory or a fallback value.
```javascript
function setupCPUTelemetry() {
const coreCount = navigator.hardwareConcurrency || 4;
document.getElementById('cpu-cores').innerText = coreCount;
let html = '';
for(let i=0; i<4; i++) {
html += ` CORE_0${i} 0%
`;
}
document.getElementById('cpu-bars').innerHTML = html;
// Simulate CPU activity
setInterval(() => {
const baseLoad = 10 + Math.random() * 20;
for(let i=0; i<4; i++) {
const load = Math.min(100, baseLoad + (Math.random() * 30));
document.getElementById(`core-bar-${i}`).style.width = `${load}%`;
document.getElementById(`core-val-${i}`).innerText = `${Math.floor(load)}%`;
}
const temp = 35 + Math.random() * 20;
document.getElementById('cpu-temp').innerText = `${Math.floor(temp)}°C`;
document.getElementById('cpu-temp').className = temp > 50 ? "stat-val txt-pink" : "stat-val txt-green";
document.getElementById('cpu-volt').innerText = (1.1 + Math.random()*0.2).toFixed(2) + 'V';
// Memory
let used = 0;
if (window.performance && performance.memory) {
used = Math.round(performance.memory.usedJSHeapSize / 1048576);
} else {
used = 400 + Math.floor(Math.random() * 200);
}
document.getElementById('mem-used').innerText = used;
const memTotal = navigator.deviceMemory || 8;
document.getElementById('mem-total').innerText = memTotal;
const pct = Math.min(100, (used / (memTotal * 1024)) * 100);
document.getElementById('ram-bar').style.width = `${pct}%`;
}, 1000);
}
```
--------------------------------
### Initialize VAPOR_OS Core System (JavaScript)
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C2.html
This snippet initializes the VAPOR_OS core system, setting up configuration constants, utility functions, and instantiating various subsystems for real-time data display. It relies on DOM elements for rendering.
```javascript
const VaporOS = (() => {
// Configuration Constants
const CONFIG = {
refresh: { cpu: 1000, pips: 800, tasks: 2000, logs: 800, scope: 200 },
colors: {
cyan: '#8be9fd',
pink: '#ff79c6',
green: '#50fa7b',
purple: '#bd93f9',
alert: '#ff5555'
},
mockData: {
cmds: ['python3', 'node', 'vllm', 'kworker', 'docker', 'chrome', 'neural', 'ssh'],
logs: [
"Packet handshake",
"Daemon restart",
"Allocating buffer",
"Temp variance",
"User auth",
"Port scan",
"Key rotation",
"Frame drop"
]
}
};
// Utilities
const Utils = {
rand: (min, max) => Math.random() * (max - min) + min,
randInt: (min, max) => Math.floor(Math.random() * (max - min)) + min,
timeStr: () => new Date().toLocaleTimeString('en-US', {hour12:false})
};
// ... (rest of the VAPOR_OS implementation)
return {
// Expose public methods if any
};
})();
```
--------------------------------
### Update Mock Process List (JavaScript)
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C1.html
Generates and displays a mock list of running processes. It iterates 15 times, randomly selecting a command, generating a CPU percentage, PID, and determining if the process has high load. This data is then formatted into HTML table rows.
```javascript
updateProcesses() { const cmds = Config.MockData.processes; let html = ''; for (let i = 0; i < 15; i++) { const cmd = cmds[Math.floor(Math.random() * cmds.length)]; const cpu = (Math.random() * 20).toFixed(1); const pid = Math.floor(Math.random() * 90000) + 1000; const isHighLoad = Math.random() > 0.8; html += ` | root | ${cpu}% | ${cmd} [${pid}] |
`; } this.dom.tableBody.innerHTML = html;
```
--------------------------------
### Clone Repository (Bash)
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/README.md
This snippet demonstrates how to clone the CyberpunkSysMon_versionC repository from GitHub using the git clone command. This is the first step to running the project locally.
```bash
git clone https://github.com/middlefingerapp/CyberpunkSysMon_versionC.git
```
--------------------------------
### Initialize System Monitor UI Elements (JavaScript)
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C1.html
Initializes DOM element references for various system monitoring metrics like uptime, CPU cores, temperature, and battery status. It then calls initialization methods for CPU bars, battery status, and sets up interval timers for updating time and CPU usage.
```javascript
constructor() { this.dom = { clock: document.getElementById('clock'), uptime: document.getElementById('uptime'), oomTime: document.getElementById('oom-time'), cpuCores: document.getElementById('cpu-cores'), cpuContainer: document.getElementById('cpu-container'), tempVal: document.getElementById('temp-val'), battLevel: document.getElementById('batt-level'), battBar: document.getElementById('batt-bar') }; this.cpuCoreCount = navigator.hardwareConcurrency || 8; this.init(); }
init() { this.dom.cpuCores.textContent = this.cpuCoreCount; this.initCpuBars(); this.initBattery(); // Time loop setInterval(() => this.updateTime(), 1000); // CPU loop setInterval(() => this.updateCpu(), Config.UpdateRates.cpu); }
```
--------------------------------
### Initialize 3D Scene with Three.js
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C1.html
Initializes a 3D scene for rendering a mesh using Three.js. It sets up the scene, camera, and renderer, and handles window resizing. Requires Three.js library.
```javascript
class MechRenderer {
constructor(containerId, canvasId) {
this.container = document.getElementById(containerId);
this.canvas = document.getElementById(canvasId);
this.scene = null;
this.camera = null;
this.renderer = null;
this.mesh = null;
this.init();
}
init() {
this.scene = new THREE.Scene();
this.scene.background = new THREE.Color(Config.Colors.bg);
const aspect = this.container.clientWidth / this.container.clientHeight;
this.camera = new THREE.PerspectiveCamera(50, aspect, 0.1, 1000);
this.camera.position.z = 5;
this.renderer = new THREE.WebGLRenderer({ canvas: this.canvas, alpha: true, antialias: true });
const geometry = new THREE.IcosahedronGeometry(1.5, 0);
const material = new THREE.MeshBasicMaterial({ color: Config.Colors.cyan, wireframe: true });
this.mesh = new THREE.Mesh(geometry, material);
const group = new THREE.Group();
group.add(this.mesh);
this.scene.add(group);
this.handleResize();
new ResizeObserver(() => this.handleResize()).observe(this.container);
this.animate();
}
handleResize() {
if (!this.container || !this.renderer) return;
const w = this.container.clientWidth;
const h = this.container.clientHeight;
this.renderer.setSize(w, h);
this.camera.aspect = w / h;
this.camera.updateProjectionMatrix();
}
animate() {
requestAnimationFrame(() => this.animate());
if (this.mesh) this.mesh.rotation.y += 0.01;
this.renderer.render(this.scene, this.camera);
}
}
```
--------------------------------
### Initialize System Components
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C2.html
Initializes various system monitoring components, including the chronometer, telemetry module, processing unit, power system, signal monitor, and task manager. This function is typically called when the DOM is fully loaded.
```javascript
const init = () => {
new Chronometer();
new TelemetryModule();
new ProcessingUnit();
new PowerSystem();
new SignalMonitor();
new TaskManager();
};
document.addEventListener('DOMContentLoaded', VaporOS.init);
```
--------------------------------
### Include Libraries and Link to C1 Dashboard (HTML)
Source: https://context7.com/middlefingerapp/cyberpunksysmon_versionc/llms.txt
This snippet shows how to include Chart.js and Three.js libraries for the C1 dashboard and provides a link to access the C1 variant.
```html
VERSION C1 - Full-featured with 3D
```
--------------------------------
### Initialize Battery Status Monitoring (JavaScript)
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C1.html
Initializes battery status monitoring using the Battery API. It retrieves the battery level and charging status, updating the UI accordingly. If the Battery API is not supported or blocked, it displays 'EXT' for external power.
```javascript
initBattery() { if (navigator.getBattery) { navigator.getBattery().then(batt => { const update = () => { const lvl = Math.round(batt.level * 100); this.dom.battLevel.textContent = lvl + '%'; this.dom.battBar.style.width = lvl + '%'; }; update(); batt.addEventListener('levelchange', update); }).catch(err => { console.log("Battery API not supported or blocked"); this.dom.battLevel.textContent = "EXT"; this.dom.battBar.style.width = "100%"; }); } else { this.dom.battLevel.textContent = "--%"; }
```
--------------------------------
### Initialize Application Components (JavaScript)
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C1.html
Initializes various components of the CyberDeck application, including MechRenderer, RadarSystem, SystemMonitor, ProcessManager, and PerformanceTracker. This function serves as the entry point for the application.
```javascript
const init = () => {
new MechRenderer('viewport-3d', 'mech-canvas');
new RadarSystem('radarChart');
new SystemMonitor();
new ProcessManager();
new PerformanceTracker();
};
return { init };
```
--------------------------------
### Visualize CPU Load with ProcessingUnit Class (JavaScript)
Source: https://context7.com/middlefingerapp/cyberpunksysmon_versionc/llms.txt
The ProcessingUnit class creates an 8-core CPU visualization with 20 'pips' per core. It simulates load levels and uses color coding (pink for warning, red for critical) to indicate high usage. This class depends on a 'cpu-container' element in the HTML and uses `setInterval` for simulation.
```javascript
class ProcessingUnit {
constructor() {
this.container = document.getElementById('cpu-container');
// Create 8 rows of 20 pips each
let html = '';
for(let i = 0; i < 8; i++) {
const pips = Array(20).fill('').join('');
html += "\n ";
}
this.container.innerHTML = html;
setInterval(() => this.simulate(), 800);
}
simulate() {
for(let i = 0; i < 8; i++) {
const track = document.getElementById(`cpu-track-${i}`);
const load = Math.random();
const activeCount = Math.floor(load * 20);
const pips = track.children;
for(let p = 0; p < 20; p++) {
let cls = 'pip';
if(p < activeCount) {
cls += ' active'; // Purple
if(p > 16) cls += ' crit'; // Red (>80%)
else if(p > 12) cls += ' warn'; // Pink (>60%)
}
pips[p].className = cls;
}
}
}
}
// Usage
new ProcessingUnit();
```
--------------------------------
### Update Process List - JavaScript
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C3.html
This function, 'upP', generates a list of simulated processes with random names, CPU usage percentages, and PIDs. It updates the 'proc-list' table every 2 seconds. The process names are drawn from a predefined array of common command names.
```javascript
const pTable = document.getElementById('proc-list');
const cmds = ['python3', 'node', 'vllm', 'kworker', 'docker', 'chrome', 'neural', 'ssh'];
const upP = () => {
let h = '';
for(let i=0; i<15; i++) {
const cmd = cmds[Math.floor(Math.random() * cmds.length)];
h += ` | root | ${(Math.random()*20).toFixed(1)}% | ${cmd} [${Math.floor(Math.random()*9e4)}] |
`;
}
pTable.innerHTML = h;
};
setInterval(upP, 2000);
upP();
```
--------------------------------
### Embedding Dashboard in HTML (HTML)
Source: https://context7.com/middlefingerapp/cyberpunksysmon_versionc/llms.txt
Demonstrates how to embed the system monitor dashboard into an existing HTML project. It provides two options: linking to the dashboard as a separate page or embedding it directly within an iframe.
```html
My App - System Monitor
Open System Monitor
```
--------------------------------
### Simulate Network Statistics - JavaScript
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C3.html
This snippet simulates network statistics by updating elements with IDs 'net-speed', 'net-bar', 'net-ping', 'net-rx', 'net-tx', and 'net-lat' every second. It generates random values for speed, ping, receive/transmit rates, and latency, visually representing the network speed with a progress bar.
```javascript
setInterval(() => {
const speed = (Math.random() * 100).toFixed(1);
document.getElementById('net-speed').innerText = speed;
document.getElementById('net-bar').style.width = `${Math.min(100, speed)}%`;
document.getElementById('net-ping').innerText = Math.floor(10 + Math.random() * 40) + 'ms';
document.getElementById('net-rx').innerText = (Math.random() * 100).toFixed(1) + ' KB/s';
document.getElementById('net-tx').innerText = (Math.random() * 50).toFixed(1) + ' KB/s';
document.getElementById('net-lat').innerText = Math.floor(10 + Math.random() * 30) + 'ms';
}, 1000);
```
--------------------------------
### Create Radar Chart for System Metrics with Chart.js
Source: https://context7.com/middlefingerapp/cyberpunksysmon_versionc/llms.txt
Initializes and updates a radar chart to visualize system metrics like CPU, MEM, DISK, NET, TEMP, and PWR. It uses Chart.js for rendering and updates the data every 2 seconds with random values. Requires Chart.js library and a canvas element with the ID 'radarChart'.
```javascript
class RadarSystem {
constructor(canvasId) {
this.ctx = document.getElementById(canvasId).getContext('2d');
Chart.defaults.borderColor = 'rgba(80, 80, 80, 0.5)';
Chart.defaults.color = '#6272a4';
Chart.defaults.font.family = 'JetBrains Mono';
this.chart = new Chart(this.ctx, {
type: 'radar',
data: {
labels: ['CPU', 'MEM', 'DISK', 'NET', 'TEMP', 'PWR'],
datasets: [{
data: [65, 59, 90, 81, 56, 55],
backgroundColor: 'rgba(139, 233, 253, 0.2)',
borderColor: '#8be9fd',
pointBackgroundColor: '#000000',
pointBorderColor: '#8be9fd',
pointRadius: 3,
borderWidth: 1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
r: {
angleLines: { color: '#333' },
grid: { color: '#222' },
ticks: { display: false }
}
},
plugins: { legend: { display: false } }
}
});
// Simulate data updates
setInterval(() => {
this.chart.data.datasets[0].data =
this.chart.data.datasets[0].data.map(() => Math.floor(Math.random() * 60) + 30);
this.chart.update();
}, 2000);
}
}
// Usage
new RadarSystem('radarChart');
```
--------------------------------
### Create Telemetry Module for CPU and Memory Monitoring
Source: https://context7.com/middlefingerapp/cyberpunksysmon_versionc/llms.txt
Implements a telemetry module to display CPU core utilization, temperature, and JavaScript heap memory usage. It dynamically creates progress bars for CPU cores and updates metrics every second. Relies on DOM manipulation and the Performance API for memory usage. Assumes specific HTML elements with IDs like 'cpu-bars', 'core-bar-i', 'core-val-i', 'cpu-temp-telem', 'mem-used', and 'mem-total'.
```javascript
class TelemetryModule {
constructor() {
this.coreCount = navigator.hardwareConcurrency || 4;
this.elContainer = document.getElementById('cpu-bars');
// Render CPU core bars
let html = '';
for(let i = 0; i < 4; i++) {
html += `
CORE_0${i}
0%
`;
}
this.elContainer.innerHTML = html;
// Start simulation loop
setInterval(() => this.update(), 1000);
}
update() {
const baseLoad = 10 + Math.random() * 20;
for(let i = 0; i < 4; i++) {
const load = Math.min(100, baseLoad + Math.random() * 30);
document.getElementById(`core-bar-${i}`).style.width = `${load}%`;
document.getElementById(`core-val-${i}`).textContent = `${Math.floor(load)}%`;
}
// Temperature (35-55°C range)
const temp = 35 + Math.random() * 20;
const tempEl = document.getElementById('cpu-temp-telem');
tempEl.textContent = `${Math.floor(temp)}°C`;
tempEl.className = temp > 50 ? "stat-val text-pink" : "stat-val text-green";
// Memory usage from Performance API
let used = (performance.memory)
? Math.round(performance.memory.usedJSHeapSize / 1048576)
: 400 + Math.floor(Math.random() * 200);
document.getElementById('mem-used').textContent = used;
document.getElementById('mem-total').textContent = navigator.deviceMemory || 8;
}
}
// Usage
new TelemetryModule();
```
--------------------------------
### Header and Text Color Styles
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C3.html
Styles for the main header element and utility classes for applying specific text colors from the theme palette.
```css
header { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 5px; }
.txt-cyan { color: var(--cyan); }
.txt-pink { color: var(--pink); }
.txt-purple { color: var(--purple); }
.txt-green { color: var(--green); }
```
--------------------------------
### Initialize FPS Graph (JavaScript)
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C1.html
Initializes the visual representation of the FPS graph by creating a series of 'fps-bar' elements. These bars will be dynamically updated to represent frame times.
```javascript
initGraph() { let html = ''; for(let i=0; i<30; i++) { html += ``; } this.dom.graph.innerHTML = html;
```
--------------------------------
### Update Clock, Uptime, and Process Count
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C3.html
This code runs after the DOM is fully loaded. It sets the initial CPU core count for the processing panel and then uses `setInterval` to continuously update the displayed time, system uptime, and a simulated process count every second. It also calculates and displays the elapsed time since the `systemStartTime`.
```javascript
window.addEventListener('DOMContentLoaded', () => {
setupCPUTelemetry(); // Set CPU cores for PROCESSING panel
document.getElementById('cpu-cores').innerText = (navigator.hardwareConcurrency || 8);
// Clock and Uptime
setInterval(() => {
const now = new Date();
document.getElementById('clock').innerText = now.toLocaleTimeString('en-US', {hour12:false});
document.getElementById('oom-time').innerText = now.toLocaleTimeString('en-US', {hour12:false});
const t = performance.now();
const h = Math.floor(t / 3600000).toString().padStart(2,'0');
const m = Math.floor((t % 3600000) / 60000).toString().padStart(2,'0');
const s = Math.floor((t % 60000) / 1000).toString().padStart(2,'0');
document.getElementById('uptime').innerText = `${h}:${m}:${s}`;
// Update SYSTEM_UPTIME widget
const elapsed = Date.now() - systemStartTime;
const hours = Math.floor(elapsed / 3600000);
const minutes = Math.floor((elapsed % 3600000) / 60000);
const seconds = Math.floor((elapsed % 60000) / 1000);
document.getElementById('uptime-display').innerText = `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
// Update process count
document.getElementById('process-count').innerText = 40 + Math.floor(Math.random() * 20);
}, 1000);
// Battery
if(navigator.getBattery) {
navigator.getBattery().then(b => {
const u = () => {
const l = Math.round(b.level * 100);
document.getElementById('batt-level').innerText = l + '%';
document.getElementById('batt-bar').style.width = l + '%';
};
u();
b.addEventListener('levelchange', u);
});
}
// CPU Bars (PROCESSING panel)
const cpuCont = document.getElementById('cpu-container');
let html = '';
for(let i=0; i<8; i++) {
html += ` C${i}
${Array(20).fill('
').join('')}
`;
}
cpuCont.innerHTML = html;
setInterval(() => {
for(let i=0; i<8; i++) {
const load = Math.random();
const pips = document.getElementById(`cpu-track-${i}`).children;
const active = Math.floor(load * 20);
for(let p=0; p<20; p++) {
let c = 'block-pip';
if(p < active) {
c += ' active';
if(p > 16) c += ' crit';
else if(p > 12) c += ' warn';
}
pips[p].className = c;
}
}
document.getElementById('temp-val').innerText = Math.floor(40 + Math.random() * 35);
}, 800);
// FPS Graph Setup
const fpsGraph = docum
```
--------------------------------
### Update System Time and Uptime (JavaScript)
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C1.html
Updates the displayed system time and calculates/displays the system uptime. The time is formatted to HH:MM:SS (24-hour format), and uptime is calculated from `performance.now()` and formatted as H:MM:SS.
```javascript
updateTime() { const now = new Date(); const timeStr = now.toLocaleTimeString('en-US', {hour12: false}); this.dom.clock.textContent = timeStr; this.dom.oomTime.textContent = timeStr; // Uptime calculation const t = performance.now(); const h = Math.floor(t / 3600000).toString().padStart(2,'0'); const m = Math.floor((t % 3600000) / 60000).toString().padStart(2,'0'); const s = Math.floor((t % 60000) / 1000).toString().padStart(2,'0'); this.dom.uptime.textContent = `${h}:${m}:${s}`;
```
--------------------------------
### Cyberpunk Table Styles
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C3.html
Styling for process tables, ensuring readability and a consistent cyberpunk look. Includes styles for headers, cells, and specific elements like process names.
```css
/* Table Styling with better spacing */
.proc-table { width: 100%; border-collapse: collapse; font-size: 0.85em; }
.proc-table th { text-align: left; color: var(--text-muted); border-bottom: 1px solid var(--border); padding: 6px 2px; }
.proc-table td { padding: 6px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proc-name { color: var(--cyan); }
```
--------------------------------
### TaskManager Class - Simulate Process Table and Log Feed (JavaScript)
Source: https://context7.com/middlefingerapp/cyberpunksysmon_versionc/llms.txt
The TaskManager class simulates a dynamic process list and a kernel log feed. It updates the process table with random data (user, CPU usage, command, PID) and appends timestamped log entries to a feed. It uses DOM manipulation to update the UI and relies on `setInterval` for periodic updates.
```javascript
class TaskManager {
constructor() {
this.table = document.getElementById('proc-list');
this.logs = document.getElementById('log-feed');
this.cmds = ['python3', 'node', 'vllm', 'kworker', 'docker', 'chrome', 'neural', 'ssh'];
this.logMsgs = ["Packet handshake", "Daemon restart", "Allocating buffer",
"Temp variance", "User auth", "Port scan", "Key rotation", "Frame drop"];
this.updateTasks();
setInterval(() => this.updateTasks(), 2000);
setInterval(() => this.addLog(), 800);
}
updateTasks() {
let html = '';
for(let i = 0; i < 15; i++) {
const cmd = this.cmds[Math.floor(Math.random() * this.cmds.length)];
const cpu = (Math.random() * 20).toFixed(1);
const pid = Math.floor(Math.random() * 90000);
const isHigh = Math.random() > 0.8;
html += `
| root |
${cpu}% |
${cmd} [${pid}] |
`;
}
this.table.innerHTML = html;
}
addLog() {
if(Math.random() <= 0.5) return;
const msg = this.logMsgs[Math.floor(Math.random() * this.logMsgs.length)];
const time = new Date().toLocaleTimeString('en-US', {hour12: false});
const isCrit = Math.random() > 0.9;
const id = Math.floor(Math.random() * 999);
const div = document.createElement('div');
div.className = isCrit ? "log-entry crit" : "log-entry";
div.innerHTML = `[${time}] ${isCrit ? '!' : 'i'} ${msg} #${id}`;
this.logs.prepend(div);
if(this.logs.children.length > 12) this.logs.lastChild.remove();
}
}
// Usage
new TaskManager();
```
--------------------------------
### VAPOR_OS Cyberpunk Theme Styles
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C3.html
Defines the core CSS variables and base styles for the VAPOR_OS cyberpunk theme. It sets up the color palette, fonts, and general layout for the system monitor interface.
```css
NEURAL_NET // VAPOR_OS :root { --bg-deep: #000000; --bg-panel: #050505; --border: #333333; --border-active: #555555; --cyan: #8be9fd; --purple: #bd93f9; --pink: #ff79c6; --green: #50fa7b; --alert: #ff5555; --text-muted: #6272a4; --font-mono: 'JetBrains Mono', 'Consolas', monospace; --radius: 6px; }
* { box-sizing: border-box; }
body { margin: 0; padding: 0; background-color: var(--bg-deep); color: #f8f8f2; font-family: var(--font-mono); height: 100vh; width: 100vw; overflow: hidden; font-size: 12px; }
#interface { display: grid; grid-template-columns: 22% 1fr 28%; grid-template-rows: 50px 1fr 40px; gap: 20px; padding: 20px; height: 100vh; width: 100%; }
.col { display: flex; flex-direction: column; gap: 20px; height: 100%; min-height: 0; }
.cyber-panel { background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius); position: relative; padding: 18px 15px 15px 15px; display: flex; flex-direction: column; min-height: 0; }
.cyber-panel:hover { border-color: var(--border-active); }
/* Fixed Header Positioning */
.panel-header { position: absolute; top: -10px; left: 12px; background: var(--bg-deep); padding: 0 6px; display: flex; align-items: center; font-weight: bold; font-size: 0.85em; color: var(--text-muted); z-index: 10; white-space: nowrap; }
.panel-header::before { content: '['; color: var(--border-active); margin-right: 4px;}
.panel-header::after { content: ']'; color: var(--border-active); margin-left: 4px;}
.panel-content { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
```
--------------------------------
### Add Mock Log Entry (JavaScript)
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C1.html
Adds a new, randomly generated log entry to the log feed. With a 50% probability, it creates a log entry with a timestamp, a random message from a predefined list, and a random number. Critically, it also randomly assigns a 'crit' class for high-priority messages and ensures the log feed does not exceed 12 entries.
```javascript
addLogEntry() { if (Math.random() < 0.5) return; // Random cadence const msgs = Config.MockData.logMessages; const now = new Date(); const time = now.toLocaleTimeString('en-US', {hour12: false}); const el = document.createElement('div'); const isCrit = Math.random() > 0.9; el.className = isCrit ? "log-entry crit" : "log-entry"; // Using innerHTML here for span styling within the log, sanitized inputs el.innerHTML = ` [${time}] ${isCrit ? '!' : 'i'} ${msgs[Math.floor(Math.random() * msgs.length)]} #${Math.floor(Math.random() * 999)} `; this.dom.logFeed.prepend(el); if (this.dom.logFeed.children.length > 12) { this.dom.logFeed.lastChild.remove(); }
```
--------------------------------
### Monitor Battery Status with PowerSystem Class (JavaScript)
Source: https://context7.com/middlefingerapp/cyberpunksysmon_versionc/llms.txt
The PowerSystem class utilizes the Battery Status API to display the current battery level and visually represent it with a bar. It includes a fallback mechanism for browsers that do not support the API, displaying 'EXT' for external power. Dependencies include 'batt-level' and 'batt-bar' elements in the HTML.
```javascript
class PowerSystem {
constructor() {
this.elLevel = document.getElementById('batt-level');
this.elBar = document.getElementById('batt-bar');
this.init();
}
init() {
if (navigator.getBattery) {
navigator.getBattery().then(batt => {
const update = () => {
const level = Math.round(batt.level * 100);
this.elLevel.textContent = level + '%';
this.elBar.style.width = level + '%';
};
update();
batt.addEventListener('levelchange', update);
}).catch(() => this.fallback());
} else {
this.fallback();
}
}
fallback() {
this.elLevel.textContent = "EXT"; // External power
this.elBar.style.width = "100%";
}
}
// Usage
new PowerSystem();
```
--------------------------------
### Processing Unit Pips Simulation (JavaScript)
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C2.html
The ProcessingUnit class simulates activity within processing cores using 'pips' visualization. It creates rows of pips, dynamically updating their active and critical states based on random load simulation. This class requires a DOM element with the ID 'cpu-container' and updates at a configurable interval.
```javascript
class ProcessingUnit {
constructor() {
this.container = document.getElementById('cpu-container');
this.tempVal = document.getElementById('temp-val');
this.init();
}
init() {
// Create 8 rows of pips
let html = '';
for(let i=0; i<8; i++) {
const pips = Array(20).fill('').join('');
html += ` `;
}
this.container.innerHTML = html;
setInterval(() => this.simulate(), CONFIG.refresh.pips);
}
simulate() {
for(let i=0; i<8; i++) {
const track = document.getElementById(`cpu-track-${i}`);
if(!track) continue;
const load = Math.random();
const activeCount = Math.floor(load * 20);
const pips = track.children;
for(let p=0; p<20; p++) {
let cls = 'pip';
if(p < activeCount) {
cls += ' active';
if(p > 16) cls += ' crit';
else if(p > 12) cls += ' warn';
}
pips[p].className = cls;
}
}
}
}
```
--------------------------------
### CSS Header and Footer
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C1.html
Styles the application header and footer, positioning them using grid and adding borders and text styling for separation and information display.
```css
.app-header {
grid-column: 1 / -1;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid var(--color-border);
padding-bottom: 5px;
}
.app-footer {
grid-column: 1 / -1;
border-top: 1px solid var(--color-border);
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.8em;
color: var(--color-text-muted);
padding-top: 5px;
}
```
--------------------------------
### Simulate Log Feed - JavaScript
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C3.html
This code simulates a log feed by periodically adding new log entries to the 'log-feed' element. It randomly selects messages from a predefined list and assigns a 'crit' class to some entries to indicate critical events. The log feed is capped at 12 entries.
```javascript
const logs = document.getElementById('log-feed');
const msgs = ["Packet handshake", "Daemon restart", "Allocating buffer", "Temp variance", "User auth", "Port scan", "Key rotation", "Frame drop"];
setInterval(() => {
if(Math.random() > 0.5) {
const now = new Date();
const time = now.toLocaleTimeString('en-US', {hour12:false});
const d = document.createElement('div');
const isCrit = Math.random()>0.9;
d.className = isCrit ? "log-entry crit" : "log-entry";
d.innerHTML = `[${time}] ${isCrit ? '!' : 'i'} ${msgs[Math.floor(Math.random()*msgs.length)]} #${Math.floor(Math.random()*999)}`;
logs.prepend(d);
if(logs.children.length > 12) logs.lastChild.remove();
}
}, 800);
```
--------------------------------
### Link to C3 Dashboard (HTML)
Source: https://context7.com/middlefingerapp/cyberpunksysmon_versionc/llms.txt
Provides a simple HTML link to navigate to the C3 variant of the CyberpunkSysMon dashboard.
```html
VERSION C3 - Minimal dashboard
```
--------------------------------
### Link to C2 Dashboard (HTML)
Source: https://context7.com/middlefingerapp/cyberpunksysmon_versionc/llms.txt
Provides a simple HTML link to navigate to the C2 variant of the CyberpunkSysMon dashboard.
```html
VERSION C2 - Standard dashboard
```
--------------------------------
### Bootstrap Application on DOMContentLoaded (JavaScript)
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C1.html
Attaches an event listener to the 'DOMContentLoaded' event to ensure that the CyberDeck application is initialized only after the HTML document has been fully loaded and parsed.
```javascript
document.addEventListener('DOMContentLoaded', CyberDeck.init);
```
--------------------------------
### Update CPU Usage Visualization (JavaScript)
Source: https://github.com/middlefingerapp/cyberpunksysmon_versionc/blob/main/CyberpunkDash_V_C1.html
Updates the visual representation of CPU core load. It iterates through each core, assigns a random load percentage, and updates the 'active' and 'crit'/'warn' classes on the corresponding 'pip' elements within the CPU track to reflect the load.
```javascript
updateCpu() { for(let i=0; i < 8; i++) { const load = Math.random(); const track = document.getElementById(`cpu-track-${i}`); if(!track) continue; const activeCount = Math.floor(load * 20); const pips = track.children; for(let p=0; p < 20; p++) { let cls = 'pip'; if (p < activeCount) { cls += ' active'; if (p > 16) cls += ' crit'; else if (p > 12) cls += ' warn'; } pips[p].className = cls; } } this.dom.tempVal.textContent = Math.floor(40 + Math.random() * 35);
```