Skip to content

Instantly share code, notes, and snippets.

View Cdaprod's full-sized avatar
🏠
Learn something new everyday!

David Cdaprod

🏠
Learn something new everyday!
View GitHub Profile

CNC Electrical Box Build Components List

What We Need Quantity Product Name
High Voltage Circuit Breaker 1 "Square D HOM120PCAFIC Homeline Plug-On Neutral 20 Amp Single-Pole CAFCI Circuit Breaker"
Low Voltage Circuit Breaker 2-4 For searching: "Low Voltage Circuit Breaker 24V". While specific product names were inaccessible, this term should help you find suitable options.
AC-DC Converter (Power Supply) 1-2 Product names weren't directly accessible, but search for "AC to DC Power Supply 24V" along with your required current output to find suitable options.
Step Down Transformer 0-1 "TR240VA001 Step-Down Transformer, 120VAC to 24VAC, 240VA". This product name is suggested based on searc
@Cdaprod
Cdaprod / rpiwz_setup_guide.md
Last active March 29, 2024 21:02
This is a basic setup for an ad-hoc network. Adjust the ssid, frequency, and security settings (key_mgmt) as needed for your network.Additional ModulesYour interest in exploring other USB gadget modules like MIDI, HID, Audio, and Composite devices opens a wide range of possibilities. The CONFIG_USB_CONFIGFS_F_* settings in the kernel configurati…

To refine your Raspberry Pi Zero W’s config.txt to include USB Mass Storage, Ethernet over USB, HDMI, and set up an ad-hoc WiFi network, based on your requirements and the provided configurations, here’s an updated version of config.txt and additional steps for cmdline.txt and networking:

Refined config.txt

[all]
kernel=vmlinuz
cmdline=cmdline.txt
initramfs initrd.img followkernel
dtoverlay=dwc2,dr_mode=peripheral

Setting up an Ubuntu server to function as a LinuxCNC server

...with auto-boot and network configuration involves several steps. Below, I'll guide you through the key steps to achieve this. Keep in mind that depending on your specific version of Ubuntu and hardware, some steps might require slight adjustments.

  1. Initial SetupInstall Ubuntu Server: Start by installing Ubuntu Server on your hardware. You can download it from the official Ubuntu website. Choose the LTS version for stability.Update System:sudo apt-get update && sudo apt-get upgrade -y
  2. Install LinuxCNCAdd LinuxCNC Repository: Before installing LinuxCNC, add the LinuxCNC repository to your system.sudo add-apt-repository ppa:linuxcnc/ppa sudo apt-get update Install LinuxCNC:sudo apt-get install linuxcnc-uspace -y
  3. Auto Boot ConfigurationCreate a Service for LinuxCNC: To make LinuxCNC start automatically at boot, create a systemd service file.sudo nano /etc/systemd/system/linuxcnc.service Add the following content to the file:[Unit]
@Cdaprod
Cdaprod / minio-weaviate-lcel-rag-system.py
Created March 19, 2024 19:12
This script integrates the LCEL framework for data enhancement and applies custom runnables for MinIO and Weaviate operations, following the principles outlined in the provided pseudo code. Note that the actual implementation may require adjustments based on your environment and the specific functionalities of the `unstructured` library, which s…
from minio import Minio
from weaviate import Client
import io
import json
import time
from concurrent.futures import ThreadPoolExecutor
from langchain_core.runnables import Runnable, Chain
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
from langchain_core.llms import ChatOpenAI, OpenAI
@Cdaprod
Cdaprod / flask_web_station.md
Created March 17, 2024 01:09
This setup, once secured and refined according to your needs, will allow you to configure the Raspberry Pi's Wi-Fi settings via a user-friendly web interface.

Yes, you can configure your Raspberry Pi Zero W2 running Ubuntu to act as a Wi-Fi access point and also serve a web UI for Wi-Fi configuration, similar to what you might do with Raspbian. Since you have established services running on the device, I'll guide you through setting up the access point functionality and a web-based network configuration interface without disturbing your existing setup.

Step 1: Install Necessary Packages

  1. Update your system:

    sudo apt update && sudo apt upgrade -y
  2. Install hostapd and dnsmasq:

@Cdaprod
Cdaprod / UPDATE_OBJECTS_IN_WEAVIATE.py
Created March 11, 2024 15:30
Example of how you might update objects in Weaviate with tokenized data (note: this is a conceptual example and assumes you have a function tokenize_text and a Weaviate client client set up)
from transformers import BertTokenizer
# Assuming you have a tokenizer function
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
# Iterate over objects in Weaviate (pseudo-code)
for object in weaviate_objects:
# Tokenize the text of the object
tokenized = tokenizer(object['text'], padding=True, truncation=True, return_tensors="pt")

Batch Subscribing to Slack GitHub Intergration Over Webhook

Prerequisites

  • Slack Workspace: You need access to a Slack workspace where you can add apps.
  • Python Environment: Ensure you have Python installed on your machine. This guide assumes you are using Python 3.x.
  • iOS Device: An iPhone or iPad with the Shortcuts app and Working Copy app installed.

Step 1: Create a Slack App and Incoming Webhook

  1. Create a Slack App:
@Cdaprod
Cdaprod / wled_esp_flasher.sh
Created March 6, 2024 21:55
Bash script that automates setting up a Python environment, optionally downloads WLED, and flashes firmware to multiple ESP32 devices.
#!/bin/bash
# WLEDFlasher - Effortless WLED Firmware Flashing Tool
cat << EOF
____ ____ _ ____ ____ ___ ____
/ ___| _ \ / \ | _ \| _ \ / _ \| _ \
| | | | | |/ _ \ | |_) | |_) | | | | | | |
| |___| |_| / ___ \| __/| _ <| |_| | |_| |
\____|____/_/ \_\_| |_| \_\\___/|____/
@Cdaprod
Cdaprod / PseudoLanggraphStateMachine.md
Created March 6, 2024 03:34
This pseudocode outlines the creation of a state machine similar to LangGraph using Pydantic for data validation. The Node class represents tasks or agents with their specific functions. The StateGraph manages nodes and transitions based on conditions. This abstract implementation can be extended with more sophisticated logic for conditions, nod…

To create an abstracted LangGraph-like state machine using Pydantic, we will design a system that allows for the creation of nodes (agents) and edges (transitions) in a graph that represents a workflow. The agents will have specific roles or functions, and the transitions between these agents will be dictated by the outcomes of their actions. Pydantic will be used for data validation and settings management, ensuring that the components of our state machine are well-defined and interact correctly.

Step 1: Define the Base Models with Pydantic

First, we need to define our base models for Nodes (Agents) and Edges (Transitions). Pydantic models will ensure that each component of our graph adheres to a specific structure and type, facilitating error handling and data consistency.

Step 2: Implement the Graph Structure

We will create a class for the graph itself, which holds the nodes and edges and manages the workflow's execution. This includes methods for adding nodes, adding edges, and determining the

@Cdaprod
Cdaprod / DynamicETLGraphAlgorithm.md
Last active March 6, 2024 03:35
This approach allows you to build flexible and dynamic ETL pipelines where the flow can adapt based on the data it processes. Each node in the pipeline can perform specific ETL tasks, and the decision on where the data flows next can be made dynamically, enabling complex data processing scenarios tailored to the needs of each dataset.

To create dynamic ETL (Extract, Transform, Load) pipes with dynamic edges and nodes using Pydantic for data validation, we will expand upon the previously discussed abstracted LangGraph-like state machine. This ETL pipeline will dynamically adjust its flow based on the data passed through each node, allowing for flexible data processing scenarios.

Step 1: Define the Data Model and Node Functionality

First, define Pydantic models for the data that will flow through the ETL pipeline. These models ensure that each stage of the ETL process receives and produces data in the expected format.

from pydantic import BaseModel

class DataModel(BaseModel):