Skip to content

Instantly share code, notes, and snippets.

View cyberpunk042's full-sized avatar

Cyberpunk 042 cyberpunk042

View GitHub Profile
@cyberpunk042
cyberpunk042 / debian12_configuration_script.sh
Last active November 2, 2024 20:01
TrueNAS Scale 24.04.2 Customization
#!/bin/bash
# Set script to exit on error
set -e
# Enable logging
exec > >(tee -i /var/log/setup-script.log)
exec 2>&1
echo "Starting script execution..."
@cyberpunk042
cyberpunk042 / setup_email_service.sh
Last active July 26, 2024 00:58
Docker-Compose setup script - HTTP:5080 to Flask to [Mailhog | Prod Smtp] - The script start up a mailhog container for smtp local testing when option "test" is chosen, or connect directly to the remote smtp service when option "prod" is chosen. A Python Flash app serves as the front, ready to listen on 'http://localhost:5080/send-email'.
#!/bin/bash
# Variables
PROJECT_DIR="email_service"
FLASK_APP_FILE="app.py"
DOCKERFILE="Dockerfile"
REQUIREMENTS_FILE="requirements.txt"
DOCKER_COMPOSE_FILE="docker-compose.yml"
# Default values for testing with MailHog
@cyberpunk042
cyberpunk042 / query_with_rag_data.py
Last active August 16, 2024 21:57
Snippet to query haystack-ai using a prompt and a local or remote file. The file can be knowledge, data, resources, context and what you can make sense of.
import os
import logging
import argparse
from haystack import Pipeline, PredefinedPipeline
import urllib.request
# Setup logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
@cyberpunk042
cyberpunk042 / query_with_tools.py
Last active August 16, 2024 21:51
Snippet to query openai with composio using a prompt and a given list of tools actions. The query can then make calls to the integrated tools.
import os
import logging
import argparse
from openai import OpenAI
from composio_openai import ComposioToolSet, App, Action
# Setup logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
@cyberpunk042
cyberpunk042 / ai_scrape_with_parsera.py
Last active August 16, 2024 22:44
Snippet to scrape a website for targeted elements. The input can be key-value pair or JSON string. The output can be console or file.
import os
import logging
import argparse
from parsera import Parsera
import json
import time
from requests.exceptions import RequestException
# Setup logging
logging.basicConfig(level=logging.INFO)