Skip to content

Instantly share code, notes, and snippets.

View VioletVivirand's full-sized avatar
👻
Always searching for the next job 😜

Chung-Ping Huang VioletVivirand

👻
Always searching for the next job 😜
  • Chunghwa Telecom
  • Kaohsiung, Taiwan
  • 11:05 (UTC +08:00)
View GitHub Profile
@VioletVivirand
VioletVivirand / mount-s3-on-startup-with-mountpoint-s3.md
Last active February 17, 2025 02:48
Mount S3 Bucket on Startup with Mountpoint for Amazon S3
@VioletVivirand
VioletVivirand / extract_exif_from_image.py
Last active February 13, 2025 08:46
Extract EXIF from image in Python
from PIL import Image
with Image.open(image_path) as img:
img.load()
print(img.info)
@VioletVivirand
VioletVivirand / decode_comfyui_workflow_into_json.py
Last active February 13, 2025 08:11
Decode ComfyUI workflow into JSON (Provided by Claude 3.5 Sonnet v2)
from PIL import Image
import json
def extract_workflow_from_png(image_path):
with Image.open(image_path) as img:
# Get all text chunks
for chunk in img.text.items():
if chunk[0] == "workflow":
# Parse the JSON data
workflow_data = json.loads(chunk[1])
@VioletVivirand
VioletVivirand / main.py
Last active October 8, 2024 11:49
Get multiple files from S3 at a time into a single Pandas DataFrame with AWS SDK for Pandas (awswrangler)
import awswrangler as wr
# Read multiple JSONs
# Paths are: s3://<bucket>/yyyy/mm/dd/filename.json
# Ref: https://aws-sdk-pandas.readthedocs.io/en/stable/tutorials/003%20-%20Amazon%20S3.html#2.3.2-Reading-JSON-by-prefix
df = wr.s3.read_json(f"s3://<bucket>/prefix/", lines=True).reset_index(drop=True)
@VioletVivirand
VioletVivirand / invoke-with-an-image.py
Created July 12, 2024 02:50
Invoke Amazon Bedrock Claude 3 with an image in message block
# Use the native inference API to send a text message to Anthropic Claude.
import boto3
import json
import base64
import httpx
from botocore.exceptions import ClientError
# Create a Bedrock Runtime client in the AWS Region of your choice.
@VioletVivirand
VioletVivirand / index-hlsjs.html
Last active April 1, 2024 02:44
hls.js Demo Page
<html>
<head>
<title>Hls.js demo - basic usage</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/hls.min.js"></script>
<center>
<h1>Hls.js demo - basic usage</h1>
<video height="600" id="video" controls="" disableremoteplayback=""><source type="video/mp4"></video>
@VioletVivirand
VioletVivirand / download_gists.sh
Created March 8, 2024 05:46
A Bash script to download files of a Gist answered by Gemini model
gist_id="YOUR_GIST_ID" # Replace with the actual Gist ID
download_path="." # Specify the download directory (optional)
# Get Gist information as JSON
gist_info=$(curl -s "https://api.github.com/gists/$gist_id")
# Extract file URLs using jq
file_urls=$(echo "$gist_info" | jq -r '.files[].raw_url')
I keep losing my keys. How can I keep track of them?
@VioletVivirand
VioletVivirand / 0-README.md
Last active October 19, 2021 00:22
KinBot installation (Under construction)

KinBot Installation

👷‍♀️🚧🚧🚧👷 To strangers: this is a DRAFT. Don't do the same things as me!

Dependencies:

  • Python 2.7 / 3.6
  • Open Babel with Python Binding
    • Officially recommended: Compile with Python Binding option enabled
  • Compiling Open Babel (Latest Release: GitHub)
@VioletVivirand
VioletVivirand / 0-revision-classify-text-into-categories-with-the-natural-language-api.txt
Last active March 23, 2021 08:28
Revision list for Qwiklabs Challenge Labs: Classify Text into Categories with the Natural Language API (https://google.qwiklabs.com/focuses/12704?parent=catalog)
Revision list for Qwiklabs Challenge Labs: Classify Text into Categories with the Natural Language API (https://google.qwiklabs.com/focuses/12704?parent=catalog)