Skip to content

Instantly share code, notes, and snippets.

View gh640's full-sized avatar
🍉

Goto Hayato gh640

🍉
View GitHub Profile
@gh640
gh640 / functions.php
Created September 5, 2024 04:13
WordPress: Font Library でオリジナルのフォントコレクションを追加する
<?php
add_action( 'init', 'themeslug_add_font_collections' );
/**
* フォントコレクションを追加する
*/
function themeslug_add_font_collections() {
// フォントファミリーの定義:
@gh640
gh640 / functions.php
Created September 5, 2024 04:12
WordPress: Use user ids as subfolders for uploaded media files
<?php
add_filter( 'upload_dir', 'themeslug_upload_dir' );
/**
* Use user ids as subfolders for uploaded media files.
*/
function themeslug_upload_dir( $uploads ) {
$user_id = get_current_user_id() ?: 'anonymous';
@gh640
gh640 / functions.php
Last active August 30, 2024 05:16
WordPress: Block Bindings API block samples
<?php
add_action( 'init', function () {
register_meta(
'post',
'book-genre',
[
'show_in_rest' => true,
'single' => true,
@gh640
gh640 / Dockerfile
Created July 29, 2024 00:57
Docker: Dockerfile to use ffmpeg on Debian Bookwrom
# syntax=docker/dockerfile:1
FROM debian:bookworm
RUN <<EOT
apt-get update
apt-get install -y --no-install-recommends \
ffmpeg \
> /dev/null
rm -rf /var/lib/apt/lists/*
EOT
@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 / 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