Skip to content

Instantly share code, notes, and snippets.

View gh640's full-sized avatar
🦔

Goto Hayato gh640

🦔
View GitHub Profile
@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 / 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 / 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 / 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
@gh640
gh640 / simple
Created April 5, 2024 01:52
Material for MkDocs icons (simple)
1001tracklists.svg
1password.svg
2k.svg
365datascience.svg
3m.svg
42.svg
4chan.svg
4d.svg
500px.svg
7zip.svg
@gh640
gh640 / openai_assistants_stream.py
Last active March 14, 2024 06:48
サンプル: OpenAI Assistants stream API を使う
"""OpenAI の Assistant stream API を使う
Usage:
python -m pip install 'openai==1.14.0'
export OPENAI_API_KEY='...'
python openai_assistant_stream.py
See: https://platform.openai.com/docs/assistants/overview?context=with-streaming
"""
@gh640
gh640 / dropbox-ignore.sh
Created February 13, 2024 04:09
Ignoring a direcotry in Dropbox on macOS
# Ignore
xattr -w 'com.apple.fileprovider.ignore#P' 1 my-directory
# Disable ignoring
xattr -d 'com.apple.fileprovider.ignore#P' my-directory
# My aliases
alias dropbox-exclude="xattr -w 'com.apple.fileprovider.ignore#P' 1"
alias dropbox-include="xattr -d 'com.apple.fileprovider.ignore#P'"
@gh640
gh640 / enumerate.py
Last active December 8, 2023 05:59
Prefix lines with natural numbers.
#!/usr/bin/env python3
"""Prefix lines with natural numbers."""
import sys
from typing import Literal
NUMBER_SUFFIX = "."
def main() -> str | Literal[0]:
if sys.stdin.isatty():
@gh640
gh640 / waitFor.js
Created November 21, 2023 05:51
JavaScript: async `waitFor` function
/**
* Wait for the specified milliseconds.
*/
async function waitFor(msec) {
await new Promise((resolve) => setTimeout(resolve, msec));
}