This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import vertexai | |
from vertexai.generative_models import GenerativeModel | |
import argparse | |
import random | |
import time | |
import os | |
from datetime import datetime | |
import json | |
# Constants |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sql_script_populatedb.py | |
import mysql.connector | |
import random | |
import datetime | |
import argparse | |
import json | |
import math | |
import logging | |
import os | |
import string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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  |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
resource.name, | |
service.description, | |
sku.id, | |
sku.description, | |
usage.unit, | |
usage.amount, | |
usage.amount_in_pricing_units, | |
usage.pricing_unit, | |
cost, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |