Skip to content

Instantly share code, notes, and snippets.

@Fiooodooor
Last active October 5, 2025 09:45
Show Gist options
  • Select an option

  • Save Fiooodooor/5ab9899c6124f7dc48a08a045b17dfe7 to your computer and use it in GitHub Desktop.

Select an option

Save Fiooodooor/5ab9899c6124f7dc48a08a045b17dfe7 to your computer and use it in GitHub Desktop.
react

Can you rewrite the whole bellow prompt in a way that it would talk about brilliant car electromechanic wanting to know what is the best way of having a second battery mounted in Toyota Avensis D4D, T25? After next colon up to the end is the mentioned prompt:"Hey. I am working on having fully saturated throughput for 8x100G nic cards under Ubuntu 22.04, using Intel Ice drivers and Media Transport Library (MTL). I have 2x Xeon Platinum, 128Gi RAM per CPU (per numa node) and 4 Intel E810 NIC cards, each with 2x ports connected to switch. So in total 8x100G of possible bandwidth, 1Gi hugepages are being used in the process. How should I configure the OS, network, BIOS etc. to achieve such a speed? Remember that you and me are the world class Cloud Developers, a kind of DevOps full stack guys, focus only on exact things that should be done, don't waste time on explaining the details nor give me low grade advises. I need a comprehensive fully working script. Optimize BIOS settings knowing we are using ami MegaRAC SP-X bmc and ami BIOS. Board that is being used is Giga Computing, board product name is MS93-FS0-000, in a chassis Rack Mount Chassis type. Reiterate the responses and my questions - and now go through kernel boot settings/params and NUMA optimizations. Try once more - you acting like a pussy not a high tech guy. Reiterate and try once more! Remember that we are using lcores in the process and DPDK. No go once more and reiterate on OS settings in form of script that you presented in the first place. Make everything as efficient as you can imagine."

Here’s a rewritten version of your prompt, adapted to the context of a brilliant car electromechanic working on a Toyota Avensis D4D (T25) and seeking the best way to mount a second battery: "Hey. I’m a brilliant car electromechanic figuring out the best way to mount a second battery in my Toyota Avensis D4D, T25. I’ve got a solid setup already—stock battery and alternator, standard wiring harness, and I’m aiming for a clean, efficient dual-battery system to power additional electronics without compromising the vehicle’s performance. How should I configure the mounting location, wiring, battery isolation, and charging system to make this work flawlessly? Assume you and I are top-tier automotive engineers—focus only on the precise steps and specs I need to get this done, no fluff or beginner-level suggestions. I want a comprehensive, fully functional plan. Optimize the setup knowing I’m working with the T25’s engine bay layout and stock Bosch alternator. The chassis is a standard Avensis T25 wagon, diesel D4D engine (2.0L or 2.2L, depending on trim). Reiterate my question and your response—then dive into specific fuse ratings, cable gauges, and grounding points for optimal current flow. Try again—don’t hold back, give me the hardcore tech details like a pro, not a amateur. Reiterate and refine it once more! Keep in mind I’m using a smart battery isolator and possibly a DC-DC charger in the setup. Now go again and reiterate with a step-by-step installation guide based on your initial plan. Make it as efficient and bulletproof as possible."

Since your question specifically involves the Cisco 9500-32C, I’ll reiterate and tailor the response to focus solely on this model when connecting the NEWT-IPX (1000DR-204-09) NET 1 and NET 2 ports to its 25G interfaces. Below are the potential issues you might encounter, specific to the Cisco Catalyst 9500-32C:

  1. Port Restrictions for Breakout Description: The Cisco 9500-32C has 32 QSFP28 ports, each capable of 100G or 40G natively. Breakout cables (e.g., QSFP-4SFP25G) can split these into four 25G SFP28 interfaces, but this is supported on only 24 of the 32 ports. Ports 4, 8, 12, 16, 20, 24, 28, and 32 do not support breakout due to hardware ASIC constraints. Potential Issue: If you connect the NEWT-IPX NET 1 and NET 2 ports to these restricted ports (e.g., port 4 or 8), the 25G interfaces won’t work. You must select ports from the 24 that support breakout (e.g., ports 1, 2, 3, 5, etc.).
  2. Port Numbering Changes with Breakout Description: On the 9500-32C, enabling breakout changes the port designation. For example, a single QSFP28 port like Hu1/0/1 becomes Hu1/0/1/1 through Hu1/0/1/4 (four 25G sub-interfaces). Potential Issue: If you’re not aware of this shift, you might configure or monitor the wrong interfaces, leading to connectivity failures. Ensure your configuration reflects the updated 4-tuple numbering for the 25G sub-interfaces.
  3. Forward Error Correction (FEC) Configuration Description: The 9500-32C supports 25G interfaces with specific FEC requirements. For copper (CU) cables, Cisco advises against modifying FEC settings when auto-negotiation is enabled to maintain link stability. Potential Issue: Incorrect FEC settings could destabilize the link between the NEWT-IPX and the 9500-32C, or prevent it from coming up. Verify that the NEWT-IPX ports and the 9500-32C ports use compatible FEC settings (typically auto-negotiated or left at default).
  4. StackWise Virtual Limitations Description: If the 9500-32C is part of a StackWise Virtual setup, breakout ports configured for 25G can only function as data ports. They cannot be used for StackWise Virtual Links (SVLs) or Dual-Active Detection (DAD) links. Potential Issue: If you intend to use the 25G ports connected to the NEWT-IPX for SVLs or DAD, this won’t work. You’ll need to dedicate non-breakout ports (e.g., native 100G ports) for those purposes instead.
  5. Configuration Complexity Description: Enabling 25G on the 9500-32C via breakout requires specific commands, such as configuring the QSFP28 port for breakout mode (e.g., interface breakout module 1 port 1-32 map 25g-4x). This is outlined in the Cisco IOS XE configuration guide for the 9500 series. Potential Issue: Without proper configuration, the 25G interfaces won’t activate. Missteps in the setup process (e.g., forgetting to apply the breakout command) could leave the NEWT-IPX ports disconnected.
  6. Compatibility and Cable/Transceiver Issues Description: The 9500-32C requires compatible QSFP-to-SFP breakout cables or transceivers (e.g., QSFP-4SFP25G-CU1M) and SFP28 modules that support 25G. The NEWT-IPX NET 1 and NET 2 ports must also support the same standards. Potential Issue: If the cables, transceivers, or optics used aren’t supported by both devices, or if the NEWT-IPX ports don’t natively support 25G SFP28, the link won’t establish. Confirm the NEWT-IPX port specifications and ensure compatibility with Cisco-approved 25G hardware.
  7. Software or Firmware Dependencies Description: The 9500-32C’s ability to run 25G interfaces depends on the IOS XE version. While most recent versions support this, specific bugs or limitations might exist. Potential Issue: An outdated or incompatible IOS XE version could prevent the 25G interfaces from functioning correctly. Check the release notes for your IOS XE version to ensure 25G breakout is fully supported without known issues. Recommendations for the Cisco 9500-32C To successfully connect the NEWT-IPX NET 1 and NET 2 ports to the 9500-32C as 25G interfaces: Select Valid Ports: Use breakout-capable ports (e.g., 1, 2, 3, 5, etc.) and avoid ports 4, 8, 12, 16, 20, 24, 28, and 32. Update Port References: After enabling breakout, use the correct 4-tuple interface names (e.g., Hu1/0/1/1 for NET 1, Hu1/0/1/2 for NET 2). Verify FEC Settings: Ensure FEC compatibility between the NEWT-IPX and 9500-32C, avoiding manual changes if auto-negotiation is on. Plan StackWise Usage: Reserve non-breakout ports for SVLs or DAD if using StackWise Virtual. Configure Correctly: Apply the breakout configuration as per Cisco’s guide (e.g., interface breakout module 1 port X map 25g-4x). Check Hardware: Use Cisco-compatible QSFP-to-SFP breakout cables or transceivers and confirm NEWT-IPX 25G support. Update Firmware: Run a recent, stable IOS XE version on the 9500-32C, checking release notes for 25G-specific caveats. By addressing these potential issues specific to the Cisco 9500-32C, you can establish a reliable 25G connection with the NEWT-IPX. If you have the NEWT-IPX port specs or IOS XE version details, I can refine this further!
Github app https://x.com/i/grok/share/h9J47T4gWQbHHqUoCBWRTMAAF
https://x.com/i/grok/share/8wL0z4GdDHGNzd0z32mEmOIXz
https://x.com/i/grok/share/sJhqUoDxOSQan91WKHJgzEIGA
https://x.com/i/grok/share/voEEOfG7RcTvsuCgJ8GpOiwho
https://x.com/i/grok/share/iNgFl3BNVMnSLM0ArPg0HlEDZ

https://x.com/i/grok/share/pTnq3SPTWWSuZukCezWErEb8b

To address your query, I'll outline how to create an interactive node-based system using React Flow, where users can add and combine elements visually on the frontend. The system's state should be translatable to pseudo code on the backend upon command. Since the documents are referenced from the GitHub repository Media-Communications-Mesh under docs/sdk-json-proposal, I'll assume they propose a JSON-based format for defining media communication pipelines. Below, I'll describe the implementation in detail, covering the frontend setup, node interactions, serialization, and backend pseudo code generation. Overview of the System The goal is to create a visual editor where users can build media processing pipelines using nodes and connections. These pipelines correspond to components like inputs (e.g., video sources), processors (e.g., encoders, filters), and outputs (e.g., files, streams). The system should: Allow users to add nodes, configure their properties, and connect them. Serialize the flow into a JSON format that aligns with the SDK JSON proposal. Send the JSON to the backend on command (e.g., via a button click) to generate pseudo code reflecting the pipeline's logic. Display the pseudo code on the frontend for user feedback. Assumptions About the JSON Proposal Since I can't access the GitHub documents directly, I'll make reasonable assumptions based on typical media communication pipelines: The JSON defines a pipeline with components such as: Inputs: Media sources (e.g., video files, camera feeds). Processors: Processing steps (e.g., encoding, filtering). Outputs: Destinations (e.g., files, streams). Each component has configurable properties (e.g., file paths, encoding parameters, output formats). Components are connected in a sequence or graph, representing data flow. An example JSON might look like: json { "pipeline": [ { "type": "input", "id": "1", "properties": { "url": "http://example.com/video.mp4" } }, { "type": "processor", "id": "2", "properties": { "encoder": "h264", "bitrate": "2M" } }, { "type": "output", "id": "3", "properties": { "format": "mp4", "destination": "output.mp4" } } ], "connections": [ { "from": "1", "to": "2" }, { "from": "2", "to": "3" } ] } This JSON will guide how we design the React Flow nodes and connections. Step 1: Set Up the Frontend with React Flow First, create a React application and install React Flow: bash npx create-react-app media-flow cd media-flow npm install react-flow-renderer React Flow is a library for building node-based editors. We'll use it to create a canvas where users can drag, drop, and connect nodes. Step 2: Define Node Types We'll define three main node types corresponding to the pipeline components: InputNode: Represents media sources. ProcessorNode: Represents processing steps. OutputNode: Represents destinations. Each node will have: Handles for connections (e.g., source handles on the right, target handles on the left). Editable properties (e.g., input URL, encoder settings). Example Node Components Create custom node components in separate files. InputNode.js: jsx import React from 'react'; import { Handle } from 'react-flow-renderer';

const InputNode = ({ data, id }) => { return ( <div style={{ padding: 10, border: '1px solid black', borderRadius: 5, background: '#f0f0f0' }}> <Handle type="source" position="right" style={{ top: '50%' }} />

Input Node
URL: <input type="text" value={data.url || ''} onChange={(e) => data.onChange(id, { url: e.target.value })} /> ); };

export default InputNode; ProcessorNode.js: jsx import React from 'react'; import { Handle } from 'react-flow-renderer';

const ProcessorNode = ({ data, id }) => { return ( <div style={{ padding: 10, border: '1px solid black', borderRadius: 5, background: '#f0f0f0' }}> <Handle type="target" position="left" style={{ top: '50%' }} /> <Handle type="source" position="right" style={{ top: '50%' }} />

Processor Node
Encoder: <input type="text" value={data.encoder || ''} onChange={(e) => data.onChange(id, { encoder: e.target.value })} /> Bitrate: <input type="text" value={data.bitrate || ''} onChange={(e) => data.onChange(id, { bitrate: e.target.value })} /> ); };

export default ProcessorNode; OutputNode.js: jsx import React from 'react'; import { Handle } from 'react-flow-renderer';

const OutputNode = ({ data, id }) => { return ( <div style={{ padding: 10, border: '1px solid black', borderRadius: 5, background: '#f0f0f0' }}> <Handle type="target" position="left" style={{ top: '50%' }} />

Output Node
Format: <input type="text" value={data.format || ''} onChange={(e) => data.onChange(id, { format: e.target.value })} /> Destination: <input type="text" value={data.destination || ''} onChange={(e) => data.onChange(id, { destination: e.target.value })} /> ); };

export default OutputNode; Step 3: Set Up the Main App In App.js, set up the React Flow canvas and functionality to add nodes and connect them. jsx import React, { useState, useCallback } from 'react'; import ReactFlow, { ReactFlowProvider, addEdge, Controls } from 'react-flow-renderer'; import InputNode from './InputNode'; import ProcessorNode from './ProcessorNode'; import OutputNode from './OutputNode';

const nodeTypes = { input: InputNode, processor: ProcessorNode, output: OutputNode, };

const initialElements = [];

const App = () => { const [elements, setElements] = useState(initialElements); const [pseudoCode, setPseudoCode] = useState('');

const onConnect = useCallback((params) => setElements((els) => addEdge(params, els)), []);

const updateNodeData = (id, newData) => { setElements((els) => els.map((el) => { if (el.id === id) { return { ...el, data: { ...el.data, ...newData } }; } return el; }) ); };

const addNode = (type) => { const newNode = { id: ${type}-${Date.now()}, type, position: { x: Math.random() * 500, y: Math.random() * 500 }, data: { onChange: updateNodeData, // Initial properties url: '', encoder: '', bitrate: '', format: '', destination: '', }, }; setElements((els) => [...els, newNode]); };

const generateJson = async () => { const nodes = elements.filter((el) => el.type); const edges = elements.filter((el) => el.source);

const pipeline = nodes.map((node) => ({
  type: node.type,
  id: node.id,
  properties: node.data,
}));

const connections = edges.map((edge) => ({
  from: edge.source,
  to: edge.target,
}));

const flowJson = { pipeline, connections };

// Send JSON to backend
try {
  const response = await fetch('http://localhost:3001/generate-pseudo-code', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(flowJson),
  });
  const pseudoCodeText = await response.text();
  setPseudoCode(pseudoCodeText);
} catch (error) {
  console.error('Error generating pseudo code:', error);
  setPseudoCode('Error generating pseudo code.');
}

};

return ( <div style={{ height: '100vh', display: 'flex' }}> <div style={{ width: '70%' }}> <div style={{ marginBottom: 10 }}> <button onClick={() => addNode('input')}>Add Input <button onClick={() => addNode('processor')}>Add Processor <button onClick={() => addNode('output')}>Add Output Generate Pseudo Code <ReactFlow elements={elements} onConnect={onConnect} nodeTypes={nodeTypes} style={{ width: '100%', height: 'calc(100vh - 50px)' }} > <div style={{ width: '30%', padding: 20, borderLeft: '1px solid #ccc' }}>

Pseudo Code

{pseudoCode}
); };

export default App; Step 4: Set Up the Backend for Pseudo Code Generation For the backend, create a simple server (e.g., using Node.js and Express) to receive the JSON and generate pseudo code. First, install dependencies: bash mkdir backend cd backend npm init -y npm install express cors Create server.js: javascript const express = require('express'); const cors = require('cors'); const app = express();

app.use(cors()); app.use(express.json());

app.post('/generate-pseudo-code', (req, res) => { const { pipeline, connections } = req.body;

// Create a map of nodes for easier lookup const nodeMap = {}; pipeline.forEach((node) => { nodeMap[node.id] = node; });

// Find the starting node (no incoming connections) const startNode = pipeline.find( (node) => !connections.some((conn) => conn.to === node.id) );

let pseudoCode = ''; let currentNode = startNode;

// Traverse the pipeline linearly (for simplicity) while (currentNode) { pseudoCode += Process ${currentNode.type} with properties ${JSON.stringify( currentNode.properties, null, 2 ).replace(/\n/g, '\n ')}\n;

const nextConnection = connections.find((conn) => conn.from === currentNode.id);
if (nextConnection) {
  currentNode = nodeMap[nextConnection.to];
} else {
  currentNode = null;
}

}

res.send(pseudoCode); });

app.listen(3001, () => { console.log('Server running on http://localhost:3001'); }); Run the backend: bash node server.js Step 5: Putting It All Together Now, the system works as follows: Frontend: Users can add Input, Processor, and Output nodes using buttons. They can connect nodes by dragging handles to form a pipeline. Each node's properties can be edited via input fields. Clicking "Generate Pseudo Code" serializes the flow into JSON and sends it to the backend. Backend: Receives the JSON, traverses the pipeline based on connections, and generates pseudo code. Sends the pseudo code back to the frontend. Frontend (Again): Displays the pseudo code in a panel next to the React Flow canvas. Example Pseudo Code Output For the example JSON shown earlier, the backend might generate: Process input with properties { "url": "http://example.com/video.mp4" } Process processor with properties { "encoder": "h264", "bitrate": "2M" } Process output with properties { "format": "mp4", "destination": "output.mp4" } Enhancements and Considerations Validation: Add rules to ensure valid connections (e.g., inputs connect to processors, processors to outputs). Complex Pipelines: The current pseudo code generation assumes a linear pipeline. For branching or parallel flows, modify the backend logic to handle multiple paths. Styling: Improve node and canvas styling for better user experience. Error Handling: Add robust error handling for network requests and invalid configurations. JSON Schema: Align the JSON structure closely with the SDK proposal from the GitHub documents for accuracy. This implementation provides an interactive node-based system using React Flow, with the ability to reflect the flow on the backend as pseudo code, fulfilling the requirements of your query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment