LineLengthSniff.php:
// changed for Japanese text.
// public $lineLimit = 80;
public $lineLimit = 500;
FunctionCommentSniff.php:
// comment out for Japanese comment.
// if (preg_match('|[A-Z]|', $testShort[0]) === 0) {
"""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, |
"""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 | |
""" |
/** | |
* Wait for the specified milliseconds. | |
*/ | |
async function waitFor(msec) { | |
await new Promise((resolve) => setTimeout(resolve, msec)); | |
} |
name: Use Python Poetry cache on GitHub Actions workflow | |
on: | |
push: | |
branches: | |
- main | |
env: | |
PYTHON_VERSION: "3.11" | |
POETRY_VERSION: "1.4.2" |
# 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 |
# 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'" |
"""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: |
"""Stream output of `asyncio.create_subprocess_exec()`""" | |
import asyncio | |
import sys | |
async def run(program: str, args: list[str]): | |
"""Capture output (stdout and stderr) while running external command.""" | |
proc = await asyncio.create_subprocess_exec( | |
program, *args, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE | |
) |
#!/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(): |
LineLengthSniff.php:
// changed for Japanese text.
// public $lineLimit = 80;
public $lineLimit = 500;
FunctionCommentSniff.php:
// comment out for Japanese comment.
// if (preg_match('|[A-Z]|', $testShort[0]) === 0) {