Skip to content

Instantly share code, notes, and snippets.

View gh640's full-sized avatar
🍉

Goto Hayato gh640

🍉
View GitHub Profile
@gh640
gh640 / send_message_on_google_chat.py
Last active July 5, 2024 06:24
Sample: Send a message on Google Chat group with Python `requests`
"""A sample to send message on Google Chat group with Python requests.
Prerequisites:
- Google API v1
- A webhook URL taken
- Python 3
- Requests (last tested with 2.31.0)
Usage:
@gh640
gh640 / book-author.html
Last active July 4, 2024 03:14
WordPress: Usage of Block Bindings API for custom fields
<!-- wp:paragraph {
"metadata":{
"bindings":{
"content":{
"source":"core/post-meta",
"args":{
"key":"book-author"
}
}
}
@gh640
gh640 / simple-https-server.py
Created March 7, 2021 01:43
Sample: A simple https server with Python for development (Python 3.9+).
"""Simple https server for development."""
import ssl
from http.server import HTTPServer, SimpleHTTPRequestHandler
CERTFILE = './localhost.pem'
def main():
https_server(certfile=CERTFILE)
@gh640
gh640 / firestore2csv.py
Last active May 30, 2024 08:00
Sample: Script to export Firestore collection as CSV
"""Script to export Firestore collection as CSV."""
import csv
import sys
from pathlib import Path
from firebase_admin import credentials, firestore, initialize_app
CRED_FILE = Path(__file__).resolve().parent / 'firebase-privateKey.json'
COLLECTION_NAME = 'XXX'
@gh640
gh640 / tiktoken_gpt_4o_japanese_hiragana_or_katakana.csv
Created May 17, 2024 00:45
tiktoken GPT-4o Japanese hiragana or katakana
3022
3385
3826
3829
4025
4156
4344
4868
5042
5205
@gh640
gh640 / tiktoken_gpt_4_turbo_japanese_hiragana_or_katakana.csv
Created May 17, 2024 01:05
tiktoken GPT-4 Turbo Japanese hiragana or katakana
9458
11972
15024
15682
16073
16144
16449 ・・
16556
16995
17129
@gh640
gh640 / change_multiple_openai_assistants_models.py
Created May 14, 2024 01:09
Sample: Change multiple OpenAI assistants models
"""Change multiple OpenAI Assistants' models"""
import click
from openai import OpenAI
EXCLUDED_IDS = []
MODELS_MAP = {
"gpt-4-turbo-preview": "gpt-4o",
"gpt-4-turbo": "gpt-4o",
@gh640
gh640 / use_python_poetry_cache_on_github_actions_workflow.yml
Last active April 29, 2024 15:05
Sample: Use Python Poetry cache on GitHub Actions workflow
name: Use Python Poetry cache on GitHub Actions workflow
on:
push:
branches:
- main
env:
PYTHON_VERSION: "3.11"
POETRY_VERSION: "1.4.2"
@gh640
gh640 / fontawesome
Created April 5, 2024 01:56
Material for MkDocs icons (fontawesome)
material/templates/.icons/fontawesome
├── LICENSE.txt
├── brands
│   ├── 42-group.svg
│   ├── 500px.svg
│   ├── accessible-icon.svg
│   ├── accusoft.svg
│   ├── adn.svg
│   ├── adversal.svg
│   ├── affiliatetheme.svg
@gh640
gh640 / material
Created April 5, 2024 01:55
Material for MkDocs icons (material)
ab-testing.svg
abacus.svg
abjad-arabic.svg
abjad-hebrew.svg
abugida-devanagari.svg
abugida-thai.svg
access-point-check.svg
access-point-minus.svg
access-point-network-off.svg
access-point-network.svg