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 / Wireless-Bluetooth-USB-C-Keyboard-with-ESP32-S2-Mini.md
Created July 7, 2024 02:22
This setup enables your ESP32-S3 Mini to act as a wireless Bluetooth keyboard using a USB-C keyboard. Ensure you adapt the provided code examples to fit your specific setup and environment.

Building a Wireless Bluetooth USB-C Keyboard with ESP32-S3 Mini

Creating a wireless Bluetooth USB-C keyboard using an ESP32-S3 Mini involves connecting a USB-C keyboard to an ESP32-S3 via a USB Host Shield. This project allows you to transform a wired keyboard into a wireless one, leveraging Bluetooth communication. Below is a detailed guide on how to set up and program this system.

Components Needed

  1. ESP32-S3 Mini
  2. USB Host Shield or USB Host Adapter (e.g., USB Host Shield for Arduino or a USB Host Module)
  3. USB-C Keyboard
  4. USB-C to USB-A Adapter (if necessary)
@Cdaprod
Cdaprod / video_and_audio_captions.md
Created July 3, 2024 22:55
This approach allows you to analyze and generate captions for videos using LangChain's experimental video captioning capabilities. For more detailed information and advanced usage, refer to the LangChain API documentation:

To analyze and generate captions for videos using LangChain, you can leverage the langchain_experimental.video_captioning module. Below is a comprehensive guide, including the necessary Python classes for handling video and audio models and generating captions.

Key Classes

  1. BaseModel: This class serves as a base for video and audio models.
  2. VideoModel: Represents a video segment, including start and end times and a description of the visual content.
  3. AudioModel: Represents an audio segment, including start and end times and subtitle text.
  4. CaptionModel: Represents a caption generated from video or audio models.

Implementation

@Cdaprod
Cdaprod / langchain_video_analysis.md
Created July 3, 2024 18:57
These steps provide a structured approach to processing, analyzing, and searching video files using LangChain and related tools. This workflow leverages the strengths of various components to provide comprehensive video analysis capabilities.

To process and analyze video files using LangChain, you can follow some best practices and examples from the LangChain cookbook and related resources. Here's a comprehensive approach to accomplish video analysis and search:

Extracting Frames from Video

First, you need to extract frames from the video, which can be done using a library like OpenCV:

import cv2
import os
@Cdaprod
Cdaprod / ChatGPT_Function_Call_Application_Design.md
Created July 2, 2024 18:53
By following these steps, you create a backend service that allows ChatGPT to perform actions based on user prompts. This setup leverages Python and Flask, avoiding the need for direct JavaScript interactions, and can be expanded to include more complex logic and additional services as needed.

To have ChatGPT perform actions in your application based on user prompts without using JavaScript, you can create a backend service that handles the interactions between the user inputs and the OpenAI API. Below is a step-by-step guide on how to set this up using Python and a Flask backend:

1. Define the Functions

Define the necessary functions that ChatGPT will call to interact with services like MinIO. Here’s an example:

functions = [
    {
        "name": "list_buckets",
@Cdaprod
Cdaprod / selfhosted_golang_photography_site.md
Last active July 1, 2024 21:33
By following these steps, you can create a dynamic, recursive photo album viewer in Golang, where each webpage represents a folder and its image contents, with filenames and folder names persisted.

To create a recursive-like traversal of folders and files for your photography albums, where each webpage represents a folder and its image contents, you can dynamically generate the pages based on the directory structure. This way, you won't need to manually specify folder or file names. Here's a step-by-step guide to achieve this using Golang:

Step 1: Organize Your Photos

Ensure your photos are organized into folders as follows:

/albums
  /vacation2024
    - photo1.jpg
    - photo2.jpg

Engineering My Data-Centric AI Solution

CDA-NAMESPACE by David Cannan

Lets build on the initial state I've been using, by expanding my favorite tools as a framework with additional functionalities and improving the robustness of the deployment. Here, we'll focus on the following new aspects:

  1. Advanced Data Processing with LLMs
  2. Integrating Additional AI Services
  3. Enhanced Security and Compliance
  4. Scalable Deployment
  5. Real-Time Monitoring and Alerting
@Cdaprod
Cdaprod / a-star_q_q-star.md
Created June 30, 2024 21:40
This overview provides a foundational understanding of Q* and its application in multi-step AI reasoning.

Let's dive into understanding the Q* explained: Complex Multi-Step AI Reasoning as shown in the screenshots you've shared.

Introduction to Q-Star (Q*)

Q-Star (Q*) is a novel approach that amalgamates Q-Learning and A-Star algorithms to address multi-step reasoning tasks in large language models (LLMs). This method is grounded in conceptualizing the reasoning process as a Markov Decision Process (MDP), where states represent sequential reasoning steps and actions correspond to subsequent logical conclusions.

Integration of Q-Learning and A-Star

Q-Learning’s role is to enable AI agents to navigate through a decision space by learning optimal actions through reward feedback, facilitated by the Bellman equation. A-Star contributes by providing efficient pathfinding capabilities, ensuring optimal decision pathways are identified with minimal computational waste. By combining these methodologies, Q-Star forms a robust framework that improves the LLM's ability to navigate complex reasoning tasks effectiv

@Cdaprod
Cdaprod / Apache_Guacamole_Extension_Guide.md
Created June 30, 2024 21:12
This gist provides an approximate guide to extending Apache Guacamole to support the HTTP protocol by creating a custom protocol extension.

Here are the approximate steps to extend Apache Guacamole to support the HTTP protocol. This involves creating a custom protocol extension that integrates with Guacamole's existing framework. Below are the key steps and a brief overview of the process:

Step 1: Understand the Guacamole Extension Mechanism

Guacamole allows the creation of extensions that can add or modify its functionality. These extensions can be written in Java and packaged as .jar files.

Step 2: Create the Extension Structure

Create a new directory structure for your extension. For instance:

my-guacamole-extension/
|-- src/

Understanding Init Scripts in Linux

What Are Init Scripts?

Init scripts, also known as initialization scripts, are shell scripts used in Unix-based systems to control the startup and shutdown of services. These scripts are typically located in the /etc/init.d directory and are executed by the init system (such as sysvinit, upstart, or systemd) during the boot and shutdown processes.

Purpose of Init Scripts

The primary purpose of init scripts is to manage the state of system services. They perform tasks such as starting, stopping, restarting, and reloading services. Each init script contains instructions for managing a specific service.

@Cdaprod
Cdaprod / PiWall_Automation_Script.md
Last active June 30, 2024 18:24
Piwall Setup Guide

Yes, you will need to adjust the orientation or placement of each client to properly grid the display across the single 15” screen. This involves configuring the pwomx.conf file on each client to specify its position and dimensions within the grid. Below is the revised setup script that includes this configuration step.

Revised Setup Script for PiWall

Create a script named setup_piwall.sh on the master node (192.168.0.26) to configure all Raspberry Pi devices.

Define the Environment and Configuration

#!/bin/bash