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 / tarpit.py
Created February 15, 2025 21:59
HoneyPot TarPit Python script
import socket
import time
import threading
from collections import defaultdict
# Settings
HOST = '0.0.0.0' # Listen on all interfaces
PORT = 22 # SSH default port
LOG_FILE = "attackers.log"
BLOCK_THRESHOLD = 5 # Number of attempts before blocking
@Cdaprod
Cdaprod / video_overlay_skew.py
Last active February 14, 2025 15:02
This setup will give a skewed overlay video on the left, over the background video in a 4:3 frame.
import bpy
# ✅ Fix for deletion (Avoids "Lack of Context" errors)
for obj in list(bpy.data.objects):
bpy.data.objects.remove(obj, do_unlink=True)
# Set the render resolution to 4:3 aspect ratio (1280x960)
bpy.context.scene.render.resolution_x = 1280
bpy.context.scene.render.resolution_y = 960
import React, { useEffect, useRef, useState } from 'react';
const AnimationDemo = () => {
const canvasRef = useRef(null);
const [isPlaying, setIsPlaying] = useState(false);
const [time, setTime] = useState(0);
// Define some fun animations
const animations = [
{
@Cdaprod
Cdaprod / Sync videos.ps1
Created December 19, 2024 15:14
PowerShell Windows Watcher ~> Nikon Z7 Video Sync: This approach ensures your videos are always synced to the specified folder (C:\SyncedVideos) automatically. Let me know if you’d like assistance with Task Scheduler or additional automation steps!
$source = "Z:\DCIM\100NIKON" # Replace with your camera's folder path
$destination = "C:\SyncedVideos" # Local folder to sync videos
# Ensure destination exists
if (!(Test-Path -Path $destination)) {
New-Item -ItemType Directory -Path $destination
}
# Set up the FileSystemWatcher
$watcher = New-Object System.IO.FileSystemWatcher
@Cdaprod
Cdaprod / improved-tree-alias.sh
Created November 30, 2024 18:26
Improved bash “tree” command via aliasing
# Add these lines to your ~/.bashrc or ~/.zshrc
# Backup the original tree command (optional)
alias real-tree="$(which tree)"
# Create enhanced tree alias with custom flags
alias tree='tree -aC -I ".git|node_modules|bower_components" --dirsfirst --filelimit 50'
# Additional useful tree aliases for specific use cases
alias treef='tree -af' # Show hidden files
@Cdaprod
Cdaprod / dockerfile-parser.js
Created November 19, 2024 15:52
Dockerfile parser for automatic service-discovery method in a repository that has been containerized with a `Dockerfile`
const fs = require('fs').promises;
const path = require('path');
class DockerfileParser {
static async findDockerfiles(baseDir = '.') {
const dockerfiles = [];
async function scan(dir) {
const entries = await fs.readdir(dir, { withFileTypes: true });
@Cdaprod
Cdaprod / Golang-AI-MicroService-Langgraph-Solution.md
Last active October 29, 2024 16:38
Building a robust microservice registry AI assistant tailored to Go-based system. Here we adapt an [initial LangGraph and Graphiti-based approach](https://github.com/getzep/graphiti/blob/main/examples/langgraph-agent/agent.ipynb) to fit within a Go ecosystem, leveraging alternative technologies and methodologies to achieve similar functionality.

Building a robust microservice registry AI assistant tailored to Go-based system. Here we adapt an initial LangGraph and Graphiti-based approach to fit within a Go ecosystem, leveraging alternative technologies and methodologies to achieve similar functionality.

Objective

  • Goal: Develop an AI assistant for your GitHub/Docker microservice registry service using Go, without relying on Neo4j.
  • Key Components:
    • Data Storage: Replace Neo4j/Graphiti with a suitable alternative (e.g., PostgreSQL).
    • AI Integration: Utilize OpenAI's API or similar services to handle natural language processing.
    • API Development: Build RESTful or GraphQL APIs in Go to interact with the AI assistant.
  • State Management: Implement mechanisms to maintain conversation state and persist interactions.
@Cdaprod
Cdaprod / golang-registry-solution.md
Created October 29, 2024 16:32
Build a robust microservice registry in Golang, with Golang-native solutions, that can be queried by AI.

Build a robust microservice registry in Golang, with Golang-native solutions, that can be queried by AI.

Overview

  • Goal: Build an AI assistant for your microservice registry in Golang, without relying on Neo4j.
  • Challenges: Replace the graph database functionality provided by Neo4j/Graphiti, ensure efficient data storage and retrieval, maintain robust performance, and integrate AI capabilities.

Steps to Achieve a Robust System Without Neo4j

1. Choose an Alternative Data Storage Solution

@Cdaprod
Cdaprod / synology-nas-setup-guide.md
Created October 29, 2024 15:57
A concise guide for preparing a Synology NAS for a distributed MinIO cluster. It covers cleaning the root filesystem, creating a logical volume for Docker, and configuring MinIO for optimal storage management.

This guide fixes Synology root storage issues, migrates Docker storage, and sets up a MinIO node for clustering.

Current Situation Summary:

  • Root Filesystem (/dev/md0):
    • Size: 2.3 GB
    • Used: 1.7 GB
    • Available: 483 MB (79% usage)
  • Data Volume (/volume1):
    • Size: 11 TB
  • Used: 4.8 TB
@Cdaprod
Cdaprod / Pi_TFT_Console_Display.md
Created October 19, 2024 17:38
In this gist, is a **comprehensive, detailed guide** for installing and configuring the **1.14" 240x135 PiTFT** on your Raspberry Pi Zero W2 using the "hard way" method. This guide includes **advanced scripts** to automate the installation, handle updates, and ensure robust configuration management. By following these instructions, you'll set up…

In this gist, is a comprehensive, detailed guide for installing and configuring the 1.14" 240x135 PiTFT on your Raspberry Pi Zero W2 using the "hard way" method. This guide includes advanced scripts to automate the installation, handle updates, and ensure robust configuration management. By following these instructions, you'll set up your PiTFT to display the console seamlessly and maintain its functionality across kernel updates and different Raspberry Pi models.


Table of Contents

  1. Prerequisites
  2. System Preparation
  3. Setting Up Python Virtual Environment (Optional)
  4. Physical Installation of PiTFT