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
@Cdaprod
Cdaprod / ESP-C3-Xaio-Seeed-Touch-API-GET-Request.md
Created May 21, 2024 15:14
This setup should allow you to detect touch events on your round display and trigger an API GET request when a touch is detected.

To implement a feature where tapping the round display triggers an API GET request using MicroPython on the ESP32-C3, you'll need to follow these steps:

  1. Set up the display and touch functionality.
  2. Configure Wi-Fi for network access.
  3. Handle the touch event.
  4. Make an HTTP GET request when the display is tapped.

Here's a detailed guide to help you achieve this:

1. Setting Up the Display and Touch Functionality

@Cdaprod
Cdaprod / GitHub-API-Create-Gist-with-iOS-Shortcut.md
Created May 21, 2024 15:12
By following these steps, you can create a powerful iOS Shortcut to automate the creation of GitHub Gists from Markdown content copied to your clipboard.

Creating an iOS Shortcut to create a GitHub Gist from the Markdown content in your clipboard involves several steps. Here’s a guide to accomplish this:

  1. Generate a GitHub Personal Access Token:

    • Ensure you have a GitHub Personal Access Token with the gist scope.
  2. Prepare the Script:

    • Use a Python script that takes input from the clipboard and creates a Gist. This script can be run using a web service like PythonAnywhere or a similar service that can execute scripts via a URL.
  3. Create the iOS Shortcut:

    • Use the Shortcuts app on iOS to create a new shortcut that copies the clipboard content and sends it to your script via a web request.
@Cdaprod
Cdaprod / MinIO_Webhook_ProvenanceAttestationEngine.md
Last active May 21, 2024 15:15
A refined example of a MinIO Webhook that will ensure that it captures and enumerates these events correctly as provenance attestations.

The goal is to ensure that when an object is uploaded to the subscribed bucket, it is captured as part of the provenance attestations. This can be achieved by setting up a webhook on the MinIO bucket to notify your Flask application whenever an object is uploaded. The Flask application will then log this event and store it as part of the provenance data.

Let's ensure that it captures and enumerates these events correctly as provenance attestations.

Step-by-Step Guide

  1. Set up MinIO with Webhook notifications.
  2. Create a Flask application to handle webhook notifications.
  3. Extend the ProvenanceAttestationEngine to log these webhook events.

To accommodate a display centered on one open side of the rectangular housing, you'll need to modify the 3D model so that the display side has an open frame. I'll provide an STL description that maintains the 3:4:3 ratio, with an open side that would support a centered display occupying the majority of that side.

Assumptions:

  • The display will be centered and take up 80% of the open side (length and width).
  • We'll assume the side being opened is the largest (length by width), leaving a frame on each edge.

Here's an updated STL with the open side:

solid rectangular_housing_with_display
No worries! I'll help translate any relevant information in the images for you. Let's analyze each of the images you provided.
1. **Image A990B765-3D2C-422D-8953-087FF2AA376E**:
- Shows a green wiring connector panel with numbers 1-6 and other numbers up to 25.
- Appears to be part of a controller device.
2. **Image A11ED953-2803-49AB-9A8D-A6A08034069B**:
- Features text written in Chinese.
- Likely a wiring diagram or information guide for the controller.

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: