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 / 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.
@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.

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.
@Cdaprod
Cdaprod / raspberrypi_hostapd_network_setup.md
Created January 25, 2024 22:46
To make your Raspberry Pi Zero 2 W broadcast a `hostapd` network upon powering on, you'll need to install and configure `hostapd` and `dnsmasq`, and set up a static IP for the wireless interface. Here's a detailed guide on how to achieve this:

To make your Raspberry Pi Zero 2 W broadcast a hostapd network upon powering on, you'll need to install and configure hostapd and dnsmasq, and set up a static IP for the wireless interface. Here's a detailed guide on how to achieve this:

Task Creation Chain

  1. Install Necessary Packages: Install hostapd and dnsmasq.
  2. Configure Static IP for WLAN: Set a static IP for the wireless interface.
  3. Configure Hostapd: Set up the access point details.
  4. Configure Dnsmasq: Set up the DHCP server.
  5. Enable Services on Boot: Ensure hostapd and dnsmasq start on boot.
@Cdaprod
Cdaprod / DataPreprocessingTool.py
Created October 23, 2023 05:25
Langchain tool for preprocessing text data. Version one million nine-hundred and fifty two 😂 jk version 1
import spacy
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from langchain.tools import BaseTool
from typing import Optional, Union, List
from langchain.callbacks.manager import CallbackManagerForToolRun, AsyncCallbackManagerForToolRun
class DataPreprocessingTool(BaseTool):
name = "DataPreprocessingTool"
description = "A tool for preprocessing and structuring unstructured data."

Tutorial: Implementing GPT4All Embeddings and Chroma DB without Langchain

This tutorial demonstrates how to manually set up a workflow for loading, embedding, and storing documents using GPT4All and Chroma DB, without the need for Langchain.

Prerequisites

Ensure you have the following packages installed:

pip install gpt4all chromadb requests beautifulsoup4

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