Skip to content

Instantly share code, notes, and snippets.

View gh640's full-sized avatar
🦔

Goto Hayato gh640

🦔
View GitHub Profile
@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 / sample-google-analytics-data.py
Created January 16, 2023 05:14
Sample: Getting session data of GA4 with Python and `google-analytics-data`
"""A sample to get sessions with Python and Google Analytics Data API v1.
with: google-analytics-data = "^0.16.0"
"""
from pathlib import Path
from google.analytics.data_v1beta import BetaAnalyticsDataClient
from google.analytics.data_v1beta.types import (
DateRange,
Dimension,
@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 / 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));
}
@gh640
gh640 / use_python_poetry_cache_on_github_actions_workflow.yml
Last active February 28, 2024 19:35
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 / use_mysqltuner_in_mariadb_container.sh
Last active February 28, 2024 02:10
Sample: Use MySQLTuner in `mariadb` Docker container
# MySQLTuner: https://github.com/major/MySQLTuner-perl
# Open Bash with the container.
docker exec [mariadb_or_mysql] bash
# Change the working directory to `/tmp`.
cd /tmp
# Install wget.
apt-get update
@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 / send_message_on_google_chat.py
Last active February 10, 2024 04:52
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: