Skip to content

Instantly share code, notes, and snippets.

View wenqiglantz's full-sized avatar

Wenqi Glantz wenqiglantz

View GitHub Profile
/*
Pull the repos with the most stars in the past year
*/
WITH latest_repo_name AS (
SELECT repo_name,
repo_id
FROM cybersyn.github_repos
QUALIFY ROW_NUMBER() OVER (PARTITION BY repo_id ORDER BY first_seen DESC) = 1
)
SELECT repo.repo_name,
from llama_index.prompts.base import Prompt
from llama_index.prompts.prompt_type import PromptType
TEXT_TO_SQL_TMPL = (
"Given an input question, first create a syntactically correct {dialect} "
"query to run, then look at the results of the query and return the answer. "
"You can order the results by a relevant column to return the most "
"interesting examples in the database.\n"
"Never query for all the columns from a specific table, only ask for a "
"few relevant columns given the question.\n"
def load_index(directory_path):
documents = SimpleDirectoryReader(directory_path, filename_as_id=True).load_data()
print(f"loaded documents with {len(documents)} pages")
try:
# Rebuild storage context
storage_context = StorageContext.from_defaults(persist_dir="./storage")
# Try to load the index from storage
index = load_index_from_storage(storage_context)
name: Build and Test workflow for applications accessing RDS in the pipeline
on:
workflow_call:
inputs:
# pass in environment through manual trigger, if not passed in, default to 'dev'
env:
required: true
type: string
default: 'dev'
resource "aws_iam_role" "lambda" {
name = "${var.resource_name_prefix}-role-${random_string.random_string.result}"
assume_role_policy = data.aws_iam_policy_document.simple_lambda_assume_role_policy.json
managed_policy_arns = [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
"arn:aws:iam::aws:policy/AWSXRayDaemonWriteAccess"
]
}
resource "aws_lambda_function" "lambda_function" {
function_name = var.lambda_function.function_name
runtime = var.lambda_function.runtime
handler = var.lambda_function.handler
memory_size = var.lambda_function.memory_size
timeout = var.lambda_function.timeout
filename = data.archive_file.lambda_zip.output_path
role = aws_iam_role.lambda.arn
tracing_config {
- name: set project version as environment variable
run: |
echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Delete lib in github packages so the new version can be added
run: |
set -e
RESPONSE=$(curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.NPM_TOKEN }}"\
- name: SonarQube Scan, create project in SonarQube if it doesn't exist already
if: inputs.sonar-scan-flag
env:
ADMIN_USERNAME: ${{ secrets.SONARQUBE_ADMIN_USERNAME }}
ADMIN_PASSWORD: ${{ secrets.SONARQUBE_ADMIN_PASSWORD }}
HOST_URL: ${{ secrets.SONARQUBE_HOST }}
PROJECT_KEY: ${{ inputs.sonar-project-name }}
TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
run: |
echo PROJECT_KEY is ${PROJECT_KEY}
name: Multi-env deployment tracker
on:
workflow_dispatch:
inputs:
image-tag:
description: 'Image tag'
type: string
required: true
name: Build and deploy to multiple environments
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to run the workflow against'
type: environment
required: true