Skip to content

Instantly share code, notes, and snippets.

View kouichi-c-nakamura's full-sized avatar

Kouichi C. Nakamura kouichi-c-nakamura

View GitHub Profile
@kouichi-c-nakamura
kouichi-c-nakamura / How_to_create_HTML_with_Gemini_Notebook.md
Created November 14, 2026 16:27
Gemini NotebookでHTML生成するときのtips

Gemini Notebook で HTML を安定生成・自動回収するための Tips

Gemini Notebook を Chrome リモートデバッグ(Playwright)経由で自動操作し、構造化 HTML をバッチ生成・回収する際の要点。


1. 最重要:HTML サニタイズは ```html コードブロック強制で突破する

  • 現象: プロンプトやテンプレート内に <div class="..."> などの生の HTML タグを直接書くと、Gemini Notebook のフロントエンドサニタイザがタグを危険とみなしてソースプレビューやチャット出力からタグを丸ごと消去してしまう(結果として区切り線や空行だけが残る)。
  • 解決策: テンプレートの見本および出力ルールで、必ず Markdown のコードブロック(```html 〜 ```)で囲んで出力させる。
@kouichi-c-nakamura
kouichi-c-nakamura / clear_watch_later_youtube.md
Last active October 14, 2026 02:21
Auto-purge thousands of videos from YouTube Watch Later via Userscript or Console

YouTube "Watch Later" Playlist Auto-Purge

Automated solution to bulk-delete thousands of videos (up to 5,000) from your YouTube Watch Later playlist (https://www.youtube.com/playlist?list=WL).


⚠️ Critical Prerequisites (Do Not Skip)

1. Disable Conflicting Browser Extensions

Third-party extensions (such as ad blockers, media downloaders, or YouTube enhancement tools) inject content scripts (ui.js) that intercept click events. When synthetic clicks are dispatched by automation, these extensions crash with:

@kouichi-c-nakamura
kouichi-c-nakamura / randomization_in_LLM.md
Last active October 7, 2026 02:26
LLMで「真のバラつき(疑似RNG)」を作るプロンプト設計。LLMはファイルの先頭ばかり選ぶバイアス(偏り)があるため、以下の規則を厳守して出題シードを散らすこと

Prompt-Embedded Normalized Permutations for LLM Anti-Bias Sampling (v2: Multi-Entropy Edition)

A robust, lightweight pattern for uniform, unbiased pseudo-random sampling across arbitrary intervals $[A, B]$ in pure prompt environments—eliminating the deterministic start-state problem without external code execution.


1. The Core Dilemma & Failure Modes

When an LLM is asked to "pick randomly" via prompting:

@kouichi-c-nakamura
kouichi-c-nakamura / embed_mermaid_in_Anki_HTMLl.html
Created July 12, 2026 08:15
embed mermaid code in Anki html: Comment <!-- --> can be used, but it can be broken when the mermaid code also contains HTML comments. <scripts> and custom <mermaid> will be removed by Anki automatically. So one way to safely keep mermaid code in Anki html is to embed the code as <div> 's parameter.
<mermaid-code style="display: none !important;">
graph TD
%% 全体スタイル設定
classDef main fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b;
classDef active fill:#3b82f6,stroke:#1d4ed8,stroke-width:2px,color:#fff;
classDef degress fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#78350f;
classDef adapt fill:#e0f2fe,stroke:#0369a1,stroke-width:2px,color:#0c4a6e;
%% 受容体、および補体・受容体以外の構造(灰色系)のスタイル定義
classDef receptor fill:#f8fafc,stroke:#64748b,stroke-width:2.5px,color:#1e293b;
@kouichi-c-nakamura
kouichi-c-nakamura / robocopy.md
Last active October 2, 2026 09:02
PowerShell command robocopy

One way copy job

Copy from Folder_1 to Folder_2

robocopy "C:\Source\Folder_1" "C:\Destination\Folder_2" /E /MT:8 /R:3 /W:3

Two way sync

Place @profile above def statement after from line_profiler import profile

from line_profiler import profile

@profile
def slow_function():
    total = 0
    for i in range(1000000):
 total += i
@kouichi-c-nakamura
kouichi-c-nakamura / launch.json
Created March 19, 2026 23:17
launch.json for VS Code debugger.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: give this a name",
"type": "debugpy",
"request": "launch",
@kouichi-c-nakamura
kouichi-c-nakamura / psh_version.psh
Created March 13, 2026 06:22
Know the Powershell version
$PSVersionTable
@kouichi-c-nakamura
kouichi-c-nakamura / launch.json
Last active March 3, 2026 16:10
launch.json for VS code debugger: for "python", you can specify your conda env's python.exe
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug: XXXXXXXXXX",
"type": "debugpy",
"request": "launch",
"python": "C:\\Users\\*********\\AppData\\Local\\miniconda3\\envs\\env1\\python.exe",
"program": "${workspaceFolder}/script1.py",
@kouichi-c-nakamura
kouichi-c-nakamura / .gitignore
Created January 30, 2026 02:52
.gitignore template for Python
# Python Bytecode
__pycache__/
*.py[cod]
*$py.class
# Jupyter Notebook
.ipynb_checkpoints
# VS Code settings
.vscode/