Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Introduction

MCP

  • claude mcp add –transport stdio serena – uvx –from git+https://github.com/oraios/serena serena-mcp-server

  • claude mcp add context7 – npx @upstash/context7-mcp

  • claude mcp add context7 -s project – npx -y @upstash/context7-mcp (プロジェクト単位)

  • https://zenn.dev/karaage0703/articles/3bd2957807f311

MCPサーバを削除したい場合は、以下コマンドを実行しましょう。

  • claude mcp remove xxx

  • .mcp.json

{
  "mcpServers": {
    "context7": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@upstash/context7-mcp"
      ],
      "env": {}
    },
    "serena": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/oraios/serena",
        "serena-mcp-server"
      ],
      "env": {}
    }
  }
}
  • .clang-format
# Based on Google style with customizations
BasedOnStyle: Google
ColumnLimit: 100
IndentWidth: 4
TabWidth: 4
UseTab: Never
PointerAlignment: Left
ReferenceAlignment: Left
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignOperands: true
AlignTrailingComments: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
BreakBeforeBraces: Attach
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
IncludeBlocks: Regroup
IndentCaseLabels: true
IndentPPDirectives: AfterHash
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ReflowComments: true
SortIncludes: CaseInsensitive
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++20
# Prevent breaking spaceship operator <=>
SpaceBeforeCpp11BracedList: false

serena

  • serena_config.yml
web_dashboard: false
# whether to open the Serena web dashboard (which will be accessible through your web browser) that
# shows Serena's current session logs - as an alternative to the GUI log window which
# is supported on all platforms.

web_dashboard_open_on_launch: false
# whether to open a browser window with the web dashboard when Serena starts (provided that web_dashboard
# is enabled). If set to False, you can still open the dashboard manually by navigating to
# http://localhost:24282/dashboard/ in your web browser (24282 = 0x5EDA, SErena DAshboard).
# If you have multiple instances running, a higher port will be used; try port 24283, 24284, etc.

mdbook

https://rust-lang.github.io/mdBook/index.html
https://github.com/rust-lang/mdBook

mdbook serve –open でホットリロード状態

mathjax

https://www.tohoho-web.com/ex/mathjax.html

インライン

\( \begin{eqnarray} i\hbar\frac{\partial}{\partial t}\psi(x,t)= \left(-\frac{\hbar^2}{2m}+V(x)\right)\psi(x,t) \end{eqnarray} \) エンド

ブロック \[ \mu = \frac{1}{N} \sum_{i=0} x_i \] エンド

mermaid 拡張

https://github.com/badboy/mdbook-mermaid

graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;

Use mdBook.

Read about mdBook.

A bare url: https://www.rust-lang.org.

mdBookで日本語検索

https://blog.bridgey.dev/2023/06/14/search-japanese-on-mdbook/

Markdown

mdBook’s parser adheres to the CommonMark specification with some extensions described below. You can take a quick tutorial, or try out CommonMark in real time. A complete Markdown overview is out of scope for this documentation, but below is a high level overview of some of the basics. For a more in-depth experience, check out the Markdown Guide.

Text and Paragraphs

Text is rendered relatively predictably:

Here is a line of text.

This is a new line.

Will look like you might expect:

Here is a line of text.

This is a new line.

Headings

Headings use the # marker and should be on a line by themselves. More # mean smaller headings:

### A heading 

Some text.

#### A smaller heading 

More text.

A heading

Some text.

A smaller heading

More text.

Lists

Lists can be unordered or ordered. Ordered lists will order automatically:

* milk
* eggs
* butter

1. carrots
1. celery
1. radishes
  • milk
  • eggs
  • butter
  1. carrots
  2. celery
  3. radishes

Linking to a URL or local file is easy:

Use [mdBook](https://github.com/rust-lang/mdBook). 

Read about [mdBook](mdBook.md).

A bare url: <https://www.rust-lang.org>.

Use mdBook.

Read about mdBook.

A bare url: https://www.rust-lang.org.


Relative links that end with .md will be converted to the .html extension. It is recommended to use .md links when possible. This is useful when viewing the Markdown file outside of mdBook, for example on GitHub or GitLab which render Markdown automatically.

Links to README.md will be converted to index.html. This is done since some services like GitHub render README files automatically, but web servers typically expect the root file to be called index.html.

You can link to individual headings with # fragments. For example, mdbook.md#text-and-paragraphs would link to the Text and Paragraphs section above. The ID is created by transforming the heading such as converting to lowercase and replacing spaces with dashes. You can click on any heading and look at the URL in your browser to see what the fragment looks like.

Images

Including images is simply a matter of including a link to them, much like in the Links section above. The following markdown includes the Rust logo SVG image found in the images directory at the same level as this file:

![The Rust Logo](images/rust-logo-blk.svg)

Produces the following HTML when built with mdBook:

<p><img src="images/rust-logo-blk.svg" alt="The Rust Logo" /></p>

Which, of course displays the image like so:

The Rust Logo

Extensions

mdBook has several extensions beyond the standard CommonMark specification.

Strikethrough

Text may be rendered with a horizontal line through the center by wrapping the text with one or two tilde characters on each side:

An example of ~~strikethrough text~~.

This example will render as:

An example of strikethrough text.

This follows the GitHub Strikethrough extension.

Footnotes

A footnote generates a small numbered link in the text which when clicked takes the reader to the footnote text at the bottom of the item. The footnote label is written similarly to a link reference with a caret at the front. The footnote text is written like a link reference definition, with the text following the label. Example:

This is an example of a footnote[^note].

[^note]: This text is the contents of the footnote, which will be rendered
    towards the bottom.

This example will render as:

This is an example of a footnote1.

The footnotes are automatically numbered based on the order the footnotes are written.

Tables

Tables can be written using pipes and dashes to draw the rows and columns of the table. These will be translated to HTML table matching the shape. Example:

| Header1 | Header2 |
| ------- | ------- |
| abc     | def     |

This example will render similarly to this:

Header1Header2
abcdef

See the specification for the GitHub Tables extension for more details on the exact syntax supported.

Task lists

Task lists can be used as a checklist of items that have been completed. Example:

- [x] Complete task
- [ ] Incomplete task

This will render as:

  • Complete task
  • Incomplete task

See the specification for the task list extension for more details.

Smart punctuation

Some ASCII punctuation sequences will be automatically turned into fancy Unicode characters:

ASCII sequenceUnicode
--
---
...
"“ or ”, depending on context
'‘ or ’, depending on context

So, no need to manually enter those Unicode characters!

This feature is disabled by default. To enable it, see the output.html.curly-quotes config option.

Heading attributes

Headings can have a custom HTML ID and classes. This lets you maintain the same ID even if you change the heading’s text, it also lets you add multiple classes in the heading.

Example:

# Example heading { #first .class1 .class2 }

This makes the level 1 heading with the content Example heading, ID first, and classes class1 and class2. Note that the attributes should be space-separated.

More information can be found in the heading attrs spec page.


  1. This text is the contents of the footnote, which will be rendered towards the bottom.

Free Memo

Free

.ssh/config に記述

# SSH over Session Manager
host i-* mi-*
    ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
ssh -i ~/.ssh/xxxxxxxxxxxxxxx.pem ubuntu@i-xxxxxxxxxxxxxxx

scp -r -i ~/.ssh/xxxxxxxxxxxxxxx.pem ubuntu@i-xxxxxxxxxxxxxxx:/home/ubuntu/xxx/xxxx/logs ./

scp -i ~/.ssh/xxxxxxxxxxxxxxx.pem メモ.txt ubuntu@i-xxxxxxxxxxxxxxx:/home/ubuntu

Bentley-Ottmannアルゴリズム

Zevenbergen & Thorne (1986) の曲率計算アルゴリズム

Rust

おためし

Docker

Docker関連を全て削除するコマンド

alias dockerclean='docker rm -f `docker ps -aq` ; docker rmi -f `docker images -q` ; docker volume rm $(docker volume ls -qf dangling=true) ; docker builder prune -af ; docker network prune -f ; docker system df'

docker_buildコマンドでCPUアーキテクチャを指定する場合の例

docker build --platform linux/amd64 -t xxxxxxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com/h4b-ecs-helloworld:0.0.1 .

DockerfileでCPUアーキテクチャを指定する場合の例

FROM --platform=linux/amd64 ubuntu:18.04

docker compose で 指定する場合

  app:
    app_base
    image: rails_latest
    build:
      context: .
      dockerfile: Dockerfile-deploy
    platform: linux/x86_64 <=== ここ

Elasticsearch

Github

以下のシークレットが必要です

 ${{ secrets.AWS_GIT_ACTIONS_DEV_ROLE_ARN }} (設定例) arn:aws:iam::xxxxxxxxx:role/xxxxxxxx-Role
 ${{ secrets.AWS_EC2_DEV_SECURITY_GROUP_ID }} (設定例) sg-0xxxxxxxx

 ${{ secrets.AWS_GIT_ACTIONS_DEV_ROLE_ARN }} ロールには以下のポリシーが必要です。
 信頼ポリシー
 {
     "Version": "2012-10-17",
     "Statement": [
         {
             "Effect": "Allow",
             "Principal": {
                 "Federated": "arn:aws:iam:<aws account no>::oidc-provider/token.actions.githubusercontent.com"
             },
             "Action": "sts:AssumeRoleWithWebIdentity",
             "Condition": {
                 "StringEquals": {
                     "token.actions.githubusercontent.com:aud": "sts.amazonaws.com"
                 },
                 "StringLike": {
                     "token.actions.githubusercontent.com:sub": "repo:<team>/<repname>:ref:refs/heads/*"
                 }
             }
         }
     ]
 }
 許可ポリシー
 {
     "Version": "2012-10-17",
     "Statement": [
         {
             "Action": [
                 "ec2:AuthorizeSecurityGroupIngress",
                 "ec2:RevokeSecurityGroupIngress",
             ],
             "Resource": "*",
             "Effect": "Allow"
         }
     ]
 }

Brew

/usr/local 配下: x86_64
/opt/homebrew 配下: arm64

https://blog.mksc.jp/contents/apple-silicon/

/github subscribe xxxxx/xxxxx issues, pulls, reviews, comments, branches, commits:*

https://github.com/integrations/slack#configuration

GIS

geopackageの内容を見るコマンド

ogrinfo your_file.gpkg your_layer_name -so

Nested example

Sub-chapter

Sub-chapter

Sub-chapter3

dddd