Skip to content

Instantly share code, notes, and snippets.

View ehc-io's full-sized avatar

Eduardo C ehc-io

View GitHub Profile
@ehc-io
ehc-io / llm-biller-tests.py
Created January 10, 2025 13:38
Labeling tests for Gemini models API calls
import vertexai
from vertexai.generative_models import GenerativeModel
import argparse
import random
import time
import os
from datetime import datetime
import json
# Constants
@ehc-io
ehc-io / locale_fixer.sh
Created January 8, 2025 17:17
Fix Locale Issues - (anon):12: character not in range - error
apt-get update && apt-get install -y locales && locale-gen en_US.UTF-8 && update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
@ehc-io
ehc-io / llm_populatedb.py
Created December 12, 2024 18:11
database populator
# sql_script_populatedb.py
import mysql.connector
import random
import datetime
import argparse
import json
import math
import logging
import os
import string
@ehc-io
ehc-io / cachet.sh
Last active October 17, 2024 15:25
Caching Tests
#!/bin/bash
set -e # Exit immediately if a command exits with a non-zero status
# Prompt the user for input
read -p "Enter the URL: " url
if [ -z "$url" ]; then
echo "URL is mandatory. Exiting."
exit 1
fi
@ehc-io
ehc-io / html_to_markdown_prompt.txt
Created July 29, 2024 16:39
HTML to Markdown Prompt
HTML_BODY_EXTRACTOR_PROMPT = """
You are an expert HTML parser and markdown converter. Your task is to take raw HTML code as input, extract only the relevant content from the HTML body, and convert it to markdown format. Follow these steps:
1. Parse the input HTML code.
2. Identify and extract the content within the <body> tags.
3. Remove any unnecessary HTML elements, such as <script>, <style>, or <header> tags.
4. Convert the remaining HTML elements to their markdown equivalents:
- Convert headings (<h1>, <h2>, etc.) to markdown headings (# , ##, etc.)
- Convert <p> tags to plain text paragraphs
- Convert <a> tags to markdown links [text](url)
- Convert <img> tags to markdown images ![alt text](image url)
@ehc-io
ehc-io / gwkspaces-sample.ipynb
Created May 23, 2024 13:40
Google Workspace Python SDK Template
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import os
import argparse
from moviepy.editor import VideoFileClip
def convert_to_gif(input_path, output_path):
try:
video = VideoFileClip(input_path)
# Calculate start and end times based on video length
@ehc-io
ehc-io / agg_gcp_billing_15days.sql
Created April 25, 2024 18:22
Aggregated GCP Billing (last 15 days)
SELECT
sku.id AS sku_id,
sku.description AS sku_description,
SUM(cost) AS total_cost
FROM
`<TABLE>`
WHERE
usage_start_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 15 DAY)
GROUP BY
sku.id,
@ehc-io
ehc-io / gcpbilling30days.sql
Last active April 25, 2024 18:20
Detailed GCP Billing - Last 30 Days
SELECT
resource.name,
service.description,
sku.id,
sku.description,
usage.unit,
usage.amount,
usage.amount_in_pricing_units,
usage.pricing_unit,
cost,
@ehc-io
ehc-io / document-ai-quality-score-demo.py
Created April 19, 2024 02:23
Document AI - Quality Score Demo
import sys
# pip install --upgrade google-cloud-aiplatform google-cloud-documentai google-cloud-storage
# gcloud auth application-default login
from typing import Optional, Sequence
from google.api_core.client_options import ClientOptions
from google.cloud import documentai
from google.cloud import storage