Skip to content

Instantly share code, notes, and snippets.

View qlawmarq's full-sized avatar
🏠
Working from home

Masaki Yoshiiwa qlawmarq

🏠
Working from home
View GitHub Profile
@qlawmarq
qlawmarq / search-github-starred-repo-by-gpt.ipynb
Last active May 16, 2023 06:07
Search GitHub Starred repo by LlamaIndex (GPT Index)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@qlawmarq
qlawmarq / sqlchain.py
Last active June 8, 2023 00:56
Chat with SQL database (MySQL)
from langchain.llms import OpenAI
from langchain import OpenAI, SQLDatabase, SQLDatabaseChain
from langchain.prompts.prompt import PromptTemplate
import os
def chat_with_mysql_database(prompt: str):
"""
Args:
prompt (str): Question to ask e.g. "Generate an SQL query to retrieve all users"
Returns:
@qlawmarq
qlawmarq / clone-k8s-deployment.sh
Created July 18, 2023 05:00
Clone kubernetes(k8s) deployment
# The following is an example of a command to clone an development(ex-app-development) as an production(ex-app-production).
kubectl get deployment ex-app-development -o json \
| jq '.metadata.name = "ex-app-production"' \
| kubectl apply -f -
@qlawmarq
qlawmarq / github-actions-deployer-for-google-cloud-run.yml
Created December 18, 2023 03:42
GitHub Actions: Deployer for Google Cloud Run
#####
#
# GitHub Actions will deploy your app to Cloud Run in Google Cloud Platform (GCP) when you push to master or main branch.
#
# 1. Set up your GCP project and Cloud Run service account
# 2. Ensure your service account has permissions to push images to Artifact Registry and deploy to Cloud Run.
# 3. Create a key.json file for the service account and add it to your GitHub repo as a secret. (In this example, the secret name is GCP_DEPLOYER_KEY)
# 4. Enable the Cloud Run API and Artifact Registry API in your GCP project
# 5. Add this file as .github/workflows/deployer.yml
# 6. Add a Dockerfile to your repo to build your app