Masato Ohba
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # YAPC::Hiroshima 2024 #CTOを破産から救おうチャレンジ クイズの紹介と解説 去る2024-02-10に取り行われた[YAPC::Hiroshima 2024](https://yapcjapan.org/2024hiroshima/)にて、弊社スマートバンクは**椅子スポンサー**をさせていただきました。**椅子にチラシを掲載する権利**を得た我々は、広島グルメマップの掲載、および「CTOを破産から救おうチャレンジ」というクイズ企画を行いました。 https://twitter.com/yutadayo/status/1756149993365528743 _"神輿"として担がれるCTOのようす_ 本記事ではこのスポンサーチャンスを活かして行なった #CTOを破産から救おうチャレンジ の紹介と解説をいたします。 <!-- more --> https://github.com/smartbank-inc/yapc2024-quiz ## #CTOを破産から救おうチャレンジ の紹介 タイトルから想像しにくいかもしれませんが、10~20分程度で回答できるコーディングクイズを出題しました。 https://github.com/smartbank-inc/yapc2024-quiz Perl, Ruby, Goの3言語のいずれかで挑戦可能ですので、参加者/非参加者を問わずまだ見ていない方はぜひ遊んでみてください。回答後にXにpostする導線もありますので、感想やフィードバックもお待ちしております。 ### あらすじ/設定 READMEよりあらすじを抜粋します。 >2024年新春、YAPC::Hiroshimaのスポンサーとなった株式会社スマートバンクはイベントを最大限に盛り上げるため、広島のお食事どころ紹介企画を行っています。参加者の皆様にはグルメマップをノベルティとして配布していますのでぜひご覧ください。 > >さて、当企画にあたりスマートバンクCTO @yutadayo は広島の飲食店を練り歩いたのですが...困ったことが起きました。カード決済ネットワークの途中で障害が起き、飲食店からカード会社への決済リクエストが何重にもリトライ送信されてしまったのです。 > >もし全てのリクエストがカード会社で処理されたら...口座残高がなくなりスマートバンクCTOは破産に追い込まれてしまいます。重複リクエストを適切にさばくプログラムを記述してCTOを破産から救いましょう! この内容はYAPC::Hiroshima 2024にて[@ohbarye](https://twitter.com/ohbarye)が発表した「[My Favorite Protocol: Idempotency-Key Header](https://fortee.jp/yapc-hiroshima-2024/proposal/c907c754-a4e5-4573-a14a-c8bb828e8825)」のテーマにちなんだものとなっており、発表での学びをさらに深めることもできる問題になっています。 なお、クイズの題材となっているIdempotency-Key Headerの詳しい解説は以下の資料をご覧ください。 <iframe class="speakerdeck-iframe" frameborder="0" src="https://speakerdeck.com/player/fd67dc8e804649c2ad98ff96042551d3" title="My Favorite Protocol: Idempotency-Key Header" allowfullscreen="true" style="border: 0px; background: padding-box padding-box rgba(0, 0, 0, 0.1); margin: 0px; padding: 0px; border-radius: 6px; box-shadow: rgba(0, 0, 0, 0.2) 0px 5px 40px; width: 100%; height: auto; aspect-ratio: 560 / 315;" data-ratio="1.7777777777777777"></iframe> ## 解説 クイズの内容について紹介したところで早速解説に入っていきます。 なお、本記事ではRubyでの解説とさせていただき、簡単のためIdempotency-Keyを`key`と表現します。 ### なにはともあれ実行してみる いっさいコードを変更せずに `make` で採点を走らせると以下の採点結果が出力されます。 ``` ########################### # あなたの回答 # ########################### 【CTOの訪問したお店】 - いちにち - うどんや ととや (中略) 【CTOの口座残高】 -5344845円 ########################### # 採点結果 # ########################### 【ランク】C 【CTOからの一言】もう終わりだ… ❌ CTOは破産してしまった...💸 ❌ 訪問したお店を正確に記録できなかった...💔 ``` 重複を含むすべての決済リクエストを処理してしまった結果`【CTOの口座残高】 -5344845円`となり、**派手に破産**しています。なんとかマイナスから脱却させてあげたいものです。 ### Idempotency-Key Headerの取得 まずは今回CTOを救う鍵となるkeyを取得します。シンプルにクライアントから送信されているHTTPヘッダーのうち、Idempotency-Key Headerを参照すればOKです。 ```diff post '/payments' do body = JSON.parse(request.body.read) + idempotency_key = request.env["HTTP_IDEMPOTENCY_KEY"] ``` ### keyの保存 送信されたkeyが未知か既知かを判断できるようにするため、keyをサーバ側で保存する処理を入れます。安易にグローバル変数を用意して記録します。 ```diff +idempotency_keys = {} post '/payments' do body = JSON.parse(request.body.read) idempotency_key = request.env["HTTP_IDEMPOTENCY_KEY"] payment.synchronize do balance -= Integer(body["amount"]) shop_names << body["shop_name"] + idempotency_keys[idempotency_key] = true end status 201 end ``` ### 決済処理の前にkeyの存在チェック これにより、既知のkeyが記録されるようになったので決済処理を行う前に「すでに処理済みかどうか」を判定できるようになりました。 ```diff +idempotency_keys = {} post '/payments' do body = JSON.parse(request.body.read) idempotency_key = request.env["HTTP_IDEMPOTENCY_KEY"] + if idempotency_key[idempotency_key] + status 201 + else payment.synchronize do balance -= Integer(body["amount"]) shop_names << body["shop_name"] + idempotency_keys[idempotency_key] = true end status 201 + end end ``` ここまでの実装でIdempotency-Key Headerを用いるメインシナリオがカバーできたといえます。 ![image](https://hackmd.io/_uploads/H1jRriTjT.png) `make`を実行して大勝利...かと思いきや結果は【ランク】Bです。 ``` ########################### # あなたの回答 # ########################### 【CTOの訪問したお店】 - お好み焼き みっちゃん 横川店分家 - キッチネッテ - ビストロ巴里食堂 大手町店 - リストランテマリオ - 広島やぷし軒 - 旬と肴と炙り「月あかり」 - 汁なし担担麺 キング軒 大手町本店 - 焼肉・すき焼き とみや別館 【CTOの口座残高】 18857円 ########################### # 採点結果 # ########################### 【ランク】B 【CTOからの一言】助かった…のか…? ✅ CTOを破産から救うことができた!💰 ❌ 訪問したお店を正確に記録できなかった...💔 ``` 訪問したお店を正確に記録できなかったとのことで、余分なお店を記録したか、必要なお店が不足しているか、いずれかの問題があるようです。 ### ヘッダーが付与されていないリクエストをスキップする 今一度[READMEの説明](https://github.com/smartbank-inc/yapc2024-quiz?tab=readme-ov-file#idempotency-key%E3%83%98%E3%83%83%E3%83%80%E3%83%BC%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6)をよく読むと以下の記述があります。 >Idempotency-Keyヘッダーを受け付けるAPIエンドポイントは、このヘッダーが付与されていないリクエストを処理してはいけません。 この一文から「keyを送っていないリクエストがあるのか?」と勘づいた方、疑ってくれてありがとう・・・・・・・・・! ```diff post '/payments' do body = JSON.parse(request.body.read) idempotency_key = request.env["HTTP_IDEMPOTENCY_KEY"] + puts "idempotency_key: #{idempotency_key}" ``` 標準出力にkeyを表示するようにして`docker compose logs`にて値を確認するとkeyが存在しないリクエストが存在します。 ``` [17/Feb/2024:01:40:56 +0000] "POST /payments HTTP/1.1" 201 - 0.0001 idempotency_key: 362b327e-50a8-4074-a182-3f1016283ac2 [17/Feb/2024:01:40:56 +0000] "POST /payments HTTP/1.1" 201 - 0.0001 idempotency_key: [17/Feb/2024:01:40:56 +0000] "POST /payments HTTP/1.1" 201 - 0.0001 idempotency_key: [17/Feb/2024:01:40:56 +0000] "POST /payments HTTP/1.1" 201 - 0.0001 idempotency_key: 5b6d3bc2-f023-4efd-bbf1-b5b201a0f3d5 [17/Feb/2024:01:40:56 +0000] "POST /payments HTTP/1.1" 201 - 0.0002 idempotency_key: 5b6d3bc2-f023-4efd-bbf1-b5b201a0f3d5 [17/Feb/2024:01:40:56 +0000] "POST /payments HTTP/1.1" 201 - 0.0001 idempotency_key: ``` `nil`をkeyとして扱うことで、余分に決済処理を行なってしまっていたことがわかりました。keyがない場合にも処理をスキップするようにします。 ```diff post '/payments' do body = JSON.parse(request.body.read) idempotency_key = request.env["HTTP_IDEMPOTENCY_KEY"] - if idempotency_keys[idempotency_key] + if !idempotency_key + status 400 # 今回はステータスコードはなんでもOKですがIETF draftに従い400にしておきます + elsif idempotency_keys[idempotency_key] status 201 else ``` これにて結果が【ランク】Aとなります。CTOを破産から救いつつ、訪問したお店を正しく記録することができました 🎉 ``` ########################### # あなたの回答 # ########################### 【CTOの訪問したお店】 - お好み焼き みっちゃん 横川店分家 - キッチネッテ - ビストロ巴里食堂 大手町店 - リストランテマリオ - 旬と肴と炙り「月あかり」 - 汁なし担担麺 キング軒 大手町本店 - 焼肉・すき焼き とみや別館 【CTOの口座残高】 25544円 ########################### # 採点結果 # ########################### 【ランク】A 【CTOからの一言】助けてくれてありがとう…ありがとう… ✅ CTOを破産から救うことができた!💰 ✅ 訪問したお店を正確に記録できた!🥳 ``` ### クリア後コンテンツ: 既知のkey、かつ以前と異なるペイロードには422を返す ここまででチャレンジはクリアなのですが、[クリア後コンテンツ](https://github.com/smartbank-inc/yapc2024-quiz?tab=readme-ov-file#%E3%82%AF%E3%83%AA%E3%82%A2%E5%BE%8C%E3%82%B3%E3%83%B3%E3%83%86%E3%83%B3%E3%83%84)として以下の追加仕様を用意してありました。こちらについても解説します。 >サーバ側で既知のidempotency keyに対して以前と異なるリクエストボディが送信された場合、サーバーはHTTPステータスコード422 Unprocessable Entityを返します。 この仕様を満たすためにはリクエストボディをサーバが覚えておく必要があります。そのため未知のkeyに対して決済処理を行なったときに、keyだけではなくbodyも保存するようにします。 ```diff payment.synchronize do balance -= Integer(body["amount"]) shop_names << body["shop_name"] + idempotency_keys[idempotency_key] = body end ``` 後続のリクエストで同一keyが来た際にリクエストボディも同一かどうかのチェックを行い、異なるなら422を返しましょう。 ```diff post '/payments' do body = JSON.parse(request.body.read) idempotency_key = request.env["HTTP_IDEMPOTENCY_KEY"] if !idempotency_key status 400 elsif idempotency_keys[idempotency_key] + if idempotency_keys[idempotency_key] != body + status 422 + else status 201 + end else ``` これにて【ランク】S到達です 🎉 ``` ########################### # あなたの回答 # ########################### 【CTOの訪問したお店】 - お好み焼き みっちゃん 横川店分家 - キッチネッテ - ビストロ巴里食堂 大手町店 - リストランテマリオ - 旬と肴と炙り「月あかり」 - 汁なし担担麺 キング軒 大手町本店 - 焼肉・すき焼き とみや別館 【CTOの口座残高】 25544円 ########################### # 採点結果 # ########################### 【ランク】S 【CTOからの一言】うちに入社してくれ〜! ✅ ハードモードクリア!🎊 ✅ CTOを破産から救うことができた!💰 ✅ 訪問したお店を正確に記録できた!🥳 ``` ### 最終的な実装 【ランク】Sに至る最終的な実装は以下のようになります。 ```ruby idempotency_keys = {} post '/payments' do body = JSON.parse(request.body.read) idempotency_key = request.env["HTTP_IDEMPOTENCY_KEY"] if !idempotency_key status 400 elsif idempotency_keys[idempotency_key] if idempotency_keys[idempotency_key] != body status 422 else status 201 end else payment.synchronize do balance -= Integer(body["amount"]) shop_names << body["shop_name"] idempotency_keys[idempotency_key] = body end status 201 end end ``` なかなかコードが増えましたが、Idempotency-Key Headerの提案仕様に準拠するにはもう少し追加実装が必要です。keyやボディだけでなくレスポンスも保存する必要がありますし、エラーシナリオの考慮やボディの同一性チェックももっと厳密でなければなりません。 ![image](https://hackmd.io/_uploads/Ske9Io6i6.png) 対応するすべてのAPIエンドポイントにこのような実装を行うのはかなり煩雑です。講演において「Idempotency-Key Headerのハンドリングはmiddlewareレイヤー(Rack, WSGI, PSGI etc.)での実装を推奨する」としたのですが、その理由が伝わればと思います。 さらに、今回のクイズではkeyをサーバプロセスのインメモリに保存しましたが水平スケールするアプリケーションであれば当然NGで、外部ストレージの利用が必要になります。RDBを使うのか、トランザクションをどう捉えるのか…等々、発展的な話題に派生することができますが本記事では割愛いたします。 ![image](https://hackmd.io/_uploads/ryVC8j6s6.png) ## 振り返り ### 良かったこと GitHub repositoryのtrafficを見るに、100名以上の方にrepositoryを見て頂き、数十名 (UU) の方には少なくともcloneして挑戦いただいたようでした。まったくの無風とならずに済みクイズの作り手としても安心しました。 また、今回のクイズでは回答後にXへのpost導線を設けており、ここからXにpostいただいたみなさま、盛り上げていただきありがとうございました! ![image](https://hackmd.io/_uploads/BJNTPsTi6.png) https://twitter.com/mihyaeru21/status/1756162976602886623 ### 改善できたこと #### 導線と回答ファネル YAPC::Hiroshima 2024参加者は400名ほどいたとのことなので、25%ほどにしかリーチできなかったことになります。会場のチラシ以外からも導線をたくさん目立つところに置くなど、クイズ挑戦 = repositoryへの導線をより工夫できれば良かったですね。 また、Xのpostとclone数しか知ることができず、実際にクイズに挑戦した方がどれだけいたか、採点処理がどれだけ行われたかを計測できなかったのも心残りです。採点のたびに外部にリクエストを飛ばす仕組みも企画段階では検討していたのですが、準備が間に合いませんでした...! #### 難易度 これは反省ポイントかどうかわかりませんが、難易度が適切だったかどうか?気になっています。 Xにpostされた結果はいずれも【ランク】Sを達成しており、YAPC参加者にとっては楽勝だった可能性がありますが、ランクSが早々に並んだのでC~Aを投稿しにくくなってしまった可能性もあります。こちらも採点タイミングで計測できていれば良い振り返り材料にできたなと反省です。 挑戦された方からのフィードバックお待ちしております。 #### segmentation fault on aarch64-linux Ruby 3.3.0のFiberがaarch64-linuxだと動かないようで、挑戦いただいた方からsegmentation faultが起きたとの報告を受けてしまいました。 https://bugs.ruby-lang.org/issues/20085 実はこの問題は社内でフィードバックを募ったときに同僚が踏んでいたのですが、直後にコードを変更したら再現しなくなった → さらにそのあとに変更を加えたら再現するようになっていた → 再テストが漏れたまま当日を迎えた...という経緯でした。 急遽Rubyを3.2.3にdowngradeすることで動くように修正しまして────ライブ感は出ましたが────ご迷惑をおかけしました 🙏 ## 余談 ### 3言語での出題について 上記の解説から察せられるように、スマートバンクはRubyをメイン言語とする会社です。カード決済周辺ではGoも利用しており一部のエンジニアはGoに詳しかったりもしますが、Perlについて詳しいエンジニアは(たぶん、今のところ)おりません。 どの言語で出題すべきか逡巡しましたがYAPCでPerlは外せないだろうと判断。複数言語のコードを準備するのは大変そうに思ったものの、**拡張子が異なる言語のファイルにコードをコピペすると変換してくれるJetBrains AI Assistantの便利機能**によりサクッと移植が完了。 https://www.jetbrains.com/help/idea/convert-files-to-another-language.html あとは月並みですがChatGPTに頼りつつDockerfileを書き上げる程度で済みました。 ### クライアントコードの難読化 「クライアントの挙動を見ればクイズへの回答は容易なのでは?」と思った方もいると思います。 その通りでして、repositoryに同梱しているクライアントコード `_blackbox/original_client.rb` に採点のロジックは記述されているので、見ればある程度の推測は立つものです。今回は商品・景品などのインセンティブを設けなかったため、このあたりはゆるくやらせてもらいました。 一応、`_blackbox/README.md`に「このディレクトリは見なくても解ける」旨を記述したり、実際に動くクライアントコード`client/client.rb`は難読化しておいたりと地味な工夫をしておりました。 https://twitter.com/ohbarye/status/1756181099049587184 ## おわりに イベントにてこのようなクイズ企画を実施するのは個人としても会社としても初の試みではありましたが、作問する過程や、同僚からのフィードバック、当日の反響... 各々を通じて大変楽しませてもらいました。次回以降にも活かしていける学びも得られました。 最後に、スマートバンクでは実際にIdempotency-Key Headerを導入した決済サービス[B/43](https://b43.jp/)を提供しており、冪等性を意識した堅牢な設計と実装に楽しさを感じるエンジニアを募集しています。カジュアル面談などは随時実施していますので、ぜひお気軽にお声がけください。 https://smartbank.co.jp/positions/205ff77ca53648a1952efe962422e71c --- 本記事は[@ohbarye](https://twitter.com/ohbarye)が執筆しました。本クイズの作成にあたりフィードバックをくれた [@tmnb](https://twitter.com/tmnbst) [@shohei_mitani](https://twitter.com/shohei1913) [@osyoyu](https://twitter.com/osyoyu) [@hirotea](https://twitter.com/nifuchi222222) に改めて感謝を捧げます!

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully