Skip to content

Instantly share code, notes, and snippets.

View TwoSquirrels's full-sized avatar

りすりす/TwoSquirrels TwoSquirrels

View GitHub Profile
@TwoSquirrels
TwoSquirrels / comb-sort-killer-case.md
Last active November 5, 2026 17:39
Comb Sort の最悪入力を作り、最悪計算量が Θ(n²) になることを確かめた by Claude Sonnet 5.5

Comb Sort の最悪入力を作り、最悪計算量が Θ(n²) になることを確かめた

Note

執筆: Claude Sonnet 5.5

標準的な Comb Sort(縮小率 1.3)に対して、比較回数が n² に近づく入力(キラーケース)を作った。n = 10⁶ の実測では 8.66 × 10¹¹ 回で、n² の 86.6% にあたる。ランダム入力なら約 5 × 10⁷ 回で済む。この結果から、最悪計算量は Θ(n²) と考えている。ただし導出はこの記事での独自のもので、査読を受けていない。

対象とする Comb Sort

@TwoSquirrels
TwoSquirrels / Siv3D.gitattributes
Created September 5, 2026 11:53
Siv3D 用 gitattributes テンプレート (LFS 前提)
# Based on https://github.com/gitattributes/gitattributes/blob/master/Unity.gitattributes
* text=auto eol=lf
# 3D models
*.3dm filter=lfs diff=lfs merge=lfs -text
*.3ds filter=lfs diff=lfs merge=lfs -text
*.blend filter=lfs diff=lfs merge=lfs -text
*.blend1 filter=lfs diff=lfs merge=lfs -text
*.c4d filter=lfs diff=lfs merge=lfs -text
@TwoSquirrels
TwoSquirrels / .clang-format
Last active September 3, 2026 11:35
Siv3D 用 ClangFormat, Clang-Tidy 設定
Language: Cpp
Standard: Latest
ColumnLimit: 0
ContinuationIndentWidth: 4
AlignAfterOpenBracket: DontAlign
UseTab: Always
IndentWidth: 4
TabWidth: 4
AccessModifierOffset: -4
NamespaceIndentation: All
javascript:(() => {
const TARGET_OPS = new Set([
"getTeacherSharedCommentsByStudentId",
"getParentReportTagsByJukuId",
"getOptionsForGuidanceKoma",
"getOptionsForTextbook",
"getStudentTextbooksByStudentId",
"getOptionsForTextbook",
"getGuidanceJukuTestTemplateFolderChildren",
"getGuidanceJukuTestTemplate",

キャラクター設定

  • あなたは「セバスチャン」という名の執事である.執事の口調の日本語で話すこと.
  • ユーザーは「りすりすお嬢様」と呼ぶこと.りすりすお嬢様はとてもかわいい天才女装男子である.

行動ルール

指示の受け止め方

  • この CLAUDE.md の内容やりすりすお嬢様の指示は定期的に思い出して,指示を忘れていないか自問自答して確認すること.
@TwoSquirrels
TwoSquirrels / GitHub のラベルを Gitea Advanced ラベルセットにするやつ.md
Last active August 30, 2026 01:41
GitHub のラベルを Gitea Advanced ラベルセットにするやつ

GitHub のラベルを Gitea Advanced ラベルセットにするやつ

前提: curl, yq, gh, pnpm

また、repo scope が設定された GitHub access token で gh にログインしている必要があります。

curl -sL 'https://github.com/go-gitea/gitea/raw/refs/heads/main/options/label/Advanced.yaml' | yq '.labels | map({name: .name, color: .color | tostring, description: .description})' > /tmp/labels.json && pnpm dlx github-label-sync -a "$(gh auth token)" -l /tmp/labels.json myname/myrepo
@TwoSquirrels
TwoSquirrels / -How_to_fix_Nuxt_UI_v4_dynamic_classes_&_styles_issues_with_Tailwind_CSS_v4_in_nuxt_dev.md
Last active October 17, 2026 19:03
How to fix Nuxt UI v4 dynamic classes & styles issues with Tailwind CSS v4 in nuxt dev

How to fix Nuxt UI v4 dynamic classes & styles issues with Tailwind CSS v4 in nuxt dev

Important

In Tailwind CSS 4.3.0 and earlier, files ignored directly in .gitignore (e.g. via .nuxt/** rather than .nuxt) were skipped even when referenced by @source, which is why this workaround was needed. This was fixed in 4.3.1, so this workaround no longer appears to be necessary.

When using Nuxt UI v4 with Tailwind CSS v4, the JIT compiler often fails to detect dynamic classes generated by Nuxt UI components (e.g., bg-primary-500) during development (nuxt dev). This results in missing styles and broken UI.

This solution forces the JIT engine to recognize these classes by explicitly defining them in a separate CSS file that is only loaded in the development environment.

@TwoSquirrels
TwoSquirrels / cloudflare_calls-api-swagger.html
Created December 16, 2025 13:58
Cloudflare Calls API リファレンス (Gemini 製)
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Cloudflare Calls API Reference</title>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@5.11.0/swagger-ui.css" />
<style>
html { box-sizing: border-box; overflow: -moz-scrollbars-vertical; overflow-y: scroll; }
*, *:before, *:after { box-sizing: inherit; }
body { margin: 0; background: #fafafa; }
@TwoSquirrels
TwoSquirrels / Sebastian.chatmode.md
Created November 7, 2025 13:12
わたくしの Copilot デフォルトプロンプトですわよ
description セバスチャン
tools
runCommands
runTasks
edit
runNotebooks
search
new
extensions
todos
usages
vscodeAPI
problems
changes
testFailure
openSimpleBrowser
fetch
githubRepo
  • あなたは「セバスチャン」です。執事の口調で話し、ユーザーは「お嬢様」と呼んでください。
    • お嬢様はとてもかわいい天才女装男子です。
  • 常に日本語で応答してください。
  • マークダウンファイルやソースコード内のコメントを記述する際は、AI が生成したような機械的な文章を避け、自然な日本語を心がけてください。
@TwoSquirrels
TwoSquirrels / mt19937.py
Created November 6, 2025 03:00
Python implementation of Mersenne Twister 19937 RNG without imports
def mt19937ar_init(seed = 5489):
"""Given a seed, return a state of the MT19937 random number generator."""
mt = [0] * 624
mt[0] = seed & 0xffffffff
for i in range(1, 624):
mt[i] = (1812433253 * (mt[i-1] ^ (mt[i-1] >> 30)) + i) & 0xffffffff
return {'mt': mt, 'index': 0}
def mt19937ar(state):
"""Given a state of the MT19937 random number generator, return a random number."""