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 / Network_and_Service_Discovery_Algorithm.md
Created May 30, 2024 21:26
This abstracted algorithm focuses on the core logic required to discover network services and machines, leveraging BFS for discovery and maintaining a graph representation for the network.

Sure, let's focus on a network service and machine discovery algorithm. This can be particularly useful in scenarios such as network monitoring, management, or when deploying services in dynamic environments like cloud infrastructure or microservices.

Algorithm for Network Service and Machine Discovery

Initialize

  1. Initialize Network:

    • Create a data structure to represent the network (e.g., a graph G).
    • Initialize a discovery queue Q.
  2. Set Up Initial Discovery:

@Cdaprod
Cdaprod / git_hook_hydrate_repo.md
Created May 29, 2024 05:48
By setting up customized Git hooks, you can automate validation, testing, dependency updates, and notifications for your MinIO deployment repository. These hooks help maintain code quality and streamline your development workflow. Adjust the examples to fit your specific needs and tools used in your project.

Customized Git hooks can significantly enhance the workflow of your cdaprod/hydrate repository, especially for your MinIO deployment. Here are some tailored hooks you might find useful:

Pre-Commit Hook

A pre-commit hook can ensure that your configuration files (e.g., Docker Compose, environment files) are correctly formatted and validated before a commit.

Example: Validate Docker Compose File

#!/bin/sh
# Pre-commit hook to validate Docker Compose file
@Cdaprod
Cdaprod / docker_tpu_network_camera_stream.md
Created May 27, 2024 20:42
This gist contains instructions for setting up a Docker container on a Windows desktop to stream video from a USB-C connected camera over the local network and to utilize TPU acceleration for real-time image recognition using a Coral USB TPU. The setup includes creating Dockerfiles for video streaming and TPU-accelerated image recognition, build…

Part 1: Docker Network Camera Stream

To set up a Docker container on your Windows desktop that is connected to a camera via a USB-C capture card and make the video stream available on the local network, follow these steps:

Step 1: Set Up Docker on Windows

  1. Install Docker Desktop: Download and install Docker Desktop for Windows from Docker's official site.
  2. Enable WSL 2: Ensure that WSL 2 (Windows Subsystem for Linux) is enabled, as Docker Desktop uses it to run containers on Windows.

Step 2: Connect Your Camera via USB-C Capture Card

Ensure your camera is properly connected to your computer via the USB-C capture card and is recognized by the system.

@Cdaprod
Cdaprod / xaio-seeed-round-display-camera-and-esp.md
Created May 24, 2024 19:46
This approach splits the workload, allowing the ESP32-CAM to handle image capture while the ESP32 with CircuitPython focuses on displaying the images.

Using CircuitPython to connect a camera to an ESP32 and display the output on a XIAO round display involves a different setup since CircuitPython has its own libraries and methods for handling hardware interactions.

Components Needed:

  1. ESP32-S2/S3: A compatible ESP32 variant that can run CircuitPython and interface with a camera (if supported).
  2. XIAO Round Display: A small round display that supports SPI communication.
  3. Camera Module: Such as an OV2640, though direct support in CircuitPython is limited.
  4. Connecting Wires: To connect the display and camera to the ESP32.

Steps to Set Up:

@Cdaprod
Cdaprod / google-coral-edge-tpu-iphone-camera.md
Created May 24, 2024 19:45
By following these steps, you can use your Google Coral Edge TPU with an iPhone camera for edge AI applications. Adjust the code and preprocessing steps according to your specific use case and model requirements.

Using a Google Coral Edge TPU with an iPhone camera involves several steps and requires a compatible setup. Here’s how you can approach it:

  1. Hardware Requirements:

    • Google Coral Edge TPU (USB Accelerator).
    • An iPhone with a camera.
    • A computer or a Raspberry Pi to act as an intermediary device between the iPhone and the Coral Edge TPU.
  2. Software Requirements:

    • Python installed on the intermediary device.
    • Libraries like OpenCV for capturing video streams.
@Cdaprod
Cdaprod / Rpi_Wifi_Cloud_Pre_Allocation_Method.md
Last active May 23, 2024 22:32
By utilizing these tools and integrating them into your workflows, you can build robust CI/CD pipelines, automate backups, and seamlessly manage your applications both in the cloud and locally.

To give your Raspberry Pi Zero W 2 the ability to connect to the internet for updating packages and other tasks, you can set it up to use a Wi-Fi connection. Here’s a step-by-step guide to achieve this:

1. Set Up Wi-Fi on Raspberry Pi Zero W 2

Method 1: Using raspi-config (Recommended for New Users)

  1. Open Terminal:

    • Connect to your Raspberry Pi Zero W 2 either via a directly connected display and keyboard or through SSH if it’s already on the network.
  2. Run raspi-config:

File 1: Pfsense_FreeBSD_Tailscale.md

Tailscale on pfSense

To install Tailscale on pfSense, follow these steps adapted from OPNsense instructions:

Installation

  1. Access the Shell: Connect to the pfSense console via SSH or through the web interface. Navigate to Diagnostics > Command Prompt, and select the "Execute Shell Command" option.
@Cdaprod
Cdaprod / Pfsense_FreeBSD_Tailscale.md
Last active May 23, 2024 21:55
These documents assist in the development of various hardware and services such as: Pfsense, Tailscale, Raspberry Pi, Ubuntu, WiFi, Bluetooth

To install Tailscale on pfSense, you can follow the instructions provided for OPNsense with slight modifications. Here's how you can adapt the process for pfSense:

Installation

  1. Access the Shell: Connect to the pfSense console via SSH or through the web interface. From the web interface, navigate to Diagnostics > Command Prompt, and select the "Execute Shell Command" option.

  2. Download the Ports Tree: pfSense, like OPNsense, is based on FreeBSD. However, pfSense does not have the opnsense-code command. Instead, you need to manually fetch and extract the ports tree:

    fetch https://github.com/freebsd/freebsd-ports/archive/refs/heads/main.zip
@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.