swcarpentry-ja
    • 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

      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.
      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
    • Engagement control
    • 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 Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control 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

    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.
    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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # SWC @ 千葉大学 2024-05-30, 2024-05-31 <https://software-carpentry.org/> <https://swcarpentry-ja.github.io/> ## リンク - [ワークショップ用HackMD](https://hackmd.io/@swcarpentry-ja/rkXVzlJV0) - [スライド](https://swcarpentry-ja.github.io/2024-05-30-chiba-slides/) - [ワークショップのホームページ](https://swcarpentry-ja.github.io/2024-05-30-chiba/) - [ワークショップ前のアンケート](https://carpentries.typeform.com/to/CvmMM8re?slug=2024-05-30-chiba) - [ワークショップ後のアンケート](https://carpentries.typeform.com/to/hIg7dK3r?slug=2024-05-30-chiba) ## マークダウン記法 https://qiita.com/tbpgr/items/989c6badefff69377da7 - "#"で見出し - "-"で箇条書き - "```"でコード埋め込み ```bash ls ``` ## 作業メモ by ヘルパー(5/30,31) - **シェル(Bash)** - URL: https://swcarpentry-ja.github.io/2024-05-30-chiba-slides/shell/ - [shell-lesson-data.zip](https://swcarpentry-ja.github.io/shell-novice/data/shell-lesson-data.zip)を事前にダウンロード - ターミナルを起動 - Windows: 事前にインストールしたGit Bash - スタートメニュー -> git bash と入力 - Mac OS: ターミナル.app - GUI vs CLIの説明 - ```ls # listの略(何があるかリストアップ)``` - ファイルシステムの説明 - ```pwd # print working directoryの略(パスの表示)``` - ルートディレクトリ、/の説明 - ```ls -F # 出力フォーマットの調整(環境によっては変化なし?)``` - ```clear # これまでの出力履歴を消す``` - ```ls --help # lsコマンドのヘルプファイルの表示(長いオプションは--と2回書く場合が多い)``` - ```man コマンド名 # manualの略(同じくヘルプファイルの表示)``` - チャレンジ: ls - ```cd ディレクトリ名 # change directoryの略 (別の作業ディレクトリに移動)``` - 応用例 - ```cd # ホームディレクトリに移動``` - ```cd .. # 上の階層に移動``` - ```cd ~ # 直前にいたディレクトリ``` - 絶対パス(ルートから見たパス) vs 相対パス(現在いるところから見たパス)の説明 - チャレンジ: 相対パス - シェルスクリプトの構文の説明 - 隠しファイル、隠しディレクトリ(.から始まるもの) - ```ls -a # で表示可能``` - ```ls --all # ロングフォームVer``` - ファイル、ディレクトリ操作 - ```mkdir ディレクトリ名 # make directoryの略(ディレクトリを作成)``` - 応用例 - ```mkdir -p dir1/dir2/dir3... # ネスト(入れ子)のディレクトリをいきなり作れる``` - ```ls -FR dir1 # ネストされたディレクトリを全て表示``` - ファイル名に適さない文字(スペース、-、~) - テキストエディタ(`nano`) - ```nano ファイル名 # nanoの起動``` 1. 何か書く 2. Ctrl + o: 保存 3. またはCtrl + X: nanoの終了、保存するか聞かれるから「Y」、Enter - ```cat ファイル名 # concatinateの略 (ファイルの中身を全部見る)``` - ```touch ファイル名 # ファイルが無い場合はファイルを作成、既にある場合はタイムスタンプを変更``` - 拡張子の説明 - ```rm ファイル名 # removeの略(ファイルの削除)``` - **!!!カーソルでゴミ箱に入れる場合と違い、完全に消えてしまうので注意!!!** - ```mv file1 file2 #ファイル/ディレクトリの移動、または名前の変更``` - ```cp file1 file2 # ファイルのコピー``` - ```cp -r dir1 dir2 # ディレクトリのコピー``` - ```rm -r dir # ディレクトリの削除``` - **!!!カーソルでゴミ箱に入れる場合と違い、完全に消えてしまうので注意!!!** - 複数のファイル、ディレクトリに同時に操作したい場合 1. 全部列挙する - ```cp file1 file2 dir # file1 file2をdir以下にコピー``` 2. ワイルドカード(*や?)を使う - ```cp file* dir # fileから始まるファイルをdir以下にコピー``` - チャレンジ: パターンに一致するファイル名 - こういう書き方は[正規表現](https://www.tohoho-web.com/perl/regexp.htm)ともいう - チャレンジ: ディレクトリとファイルの整理 - ターミナル上でCtrl + C(実行中のコマンドをキャンセル) - **Git** - URL: https://swcarpentry-ja.github.io/2024-05-30-chiba-slides/git/ - 教材: https://swcarpentry-ja.github.io/git-novice/01-basics.html - ```git config --global user.name "MYNAME" # ユーザー名の登録``` - ```git config --global user.email "myemail.address@gmail.com" # メールアドレスの登録``` - ```git init # 今いるディレクトリをgitレポジトリ(変更履歴の追跡対象)にする``` - ```ls -a # うまくいくと.gitが生成される``` - チャレンジ: gitレポジトリの中に、gitレポジトリを作ってしまったらどうなるか? - **使い方(基本)** 1. 何かファイル、ディレクトリを作成・変更する(e.g., ```nano mars.txt```) 2. ```git add ファイル名 # 追跡(Track)対象リストに追加``` 3. ```git commit -m "コミットメッセージ" # コミット(変更を保存)``` - ```git status # 現在の状況を表示``` - ```git log # ログ(これまでのコミットの履歴)を表示``` - ```git diff # 差分を表示(現在変更)``` - ```git diff --staged # 以前のコミットの差分を表示 ``` - コミットメッセージを囲むクォートは半角でなければいけません。プロンプトが `>dquote` となっている場合、正しくクォートを閉じられていないので、一度 `Ctl+C` でコマンドをキャンセルして、やり直すとよいです。 - **GitHub** - 他の人とともコードを共有するためのもの - とにかくローカルマシン上に秘密鍵(例 : id_rsa)、リモート側に公開鍵(例 : id_rsa.pub)がある状態を作る - それにより安全に通信できる - 秘密鍵と公開鍵のペアの生成 `ssh-keygen -t ed25519 -C "myemail.address@gmail.com"` - GitHub上で公開鍵をコピペ - `ssh -T git@github.com`でうまく通信できるかチェック - ローカル・リモート連携方法 - **1. 最初にローカルがあり、それをリモート側にpushパターン** - 同名の空リポジトリをリモート側で作る - `git remote add origin`でローカル側と連携 - `git remove -v`で確認 - **2. 最初にリモート側を作っておき、それからローカル側に落としてくるパターン** - `git clone https://github.com/ユーザー名/リポジトリ名.git`でローカルに落としてくる - 以降は普通に`git add/commit/push` - 共同作業 - 隣りの人をCollaboratorに設定、リモートリポジトリをgit cloneしてもらい、変更したものをpushしてもらう練習 - Host⇄Collaboratorの役割を逆にしてもう一度練習 - 衝突(Conflicts) - Hostがリモート側に変更を加えたことを、Collaborator側が気づかずに、`git push`したことでコンフリクトしたというシナリオ 1. ファイルに変更を加える 2. `git add/commit`をする 3. `git push origin main`をしたところrejectされる 4. `git pull`したところ、コンフリクトしているとわかる 5. 該当箇所を修正(Host側を残すか、Collab側を残すか、全く別の記述をするか) 6. `git push origin main`ができることを確認 ## 作業メモby ヘルパー(5/31) - **Docker** - URL: https://swcarpentry-ja.github.io/2024-05-30-chiba-slides/docker/ - Dockerとはコンテナ管理システム - コンテナ: 必要なデータやコードやライブラリを格納した実行中のプログラム(プロセス) - イメージ: コンテナを作るためのファイル、コンテナのベースとなるもの - コンテナと仮想マシンの違い - Docker Desktopを起動、右上にくじらのアイコンが表示されていることを確認 - **!!!注意: Dockerは常駐プログラムなので、最初に起動しておかないと、各種dockerコマンドは使えない!!!** - `docker container ls`をターミナルで実行 - 色々なオプションがあることを確認 - `docker --help` - `docker container --help` - `docker container ls --help` - `docker image --help` - `docker image ls --help` - `docker images --help` - `docker image pull hello-world`(または単に`docker pull hello-world`)でhello-worldイメージがダウンロードされる - `docker container run hello-world`(または単に`docker run hello-world`)でhello-worldの出力を確認 - `docker container run コンテナ内で実行するLinuxコマンド`で色々なことができる(`echo`, `cat`, `ls`, `whoami`, `pwd`...) - ```docker container run -it alpine sh # 対話モードで実行``` - ```exit # コンテナの中から出る場合(Ctrl + Dでも可)``` - チャレンジ: `ubuntu`コンテナ内部で`apt-get --help` - ```docker image rm イメージID```(または単に```docker rmi イメージID```)でイメージファイルを削除 - **!!!注意: そのイメージから作られたコンテナがまだ起動中だと削除できない!!!** - ```docker container ls```(または単に```docker ps```)で起動中のコンテナを一覧 - ```docker container ls --all```だと、起動はしていないけど、シャットダウンもされていない状態のコンテナ達で出力 - ```docker container prune # 全てのコンテナを削除``` - **DockerHub** - Dockerイメージを登録するところ - cf. PythonのDockerイメージ(https://hub.docker.com/_/python) - ```docker pull ユーザー名/イメージ名:タグ名``` - `3.8`や`latest`などタグの区別がある - 何も指定しないとlatest - チャレンジ: DockerHubから`rocker/tidyverse:3.6.1`を`docker pull` - 優良イメージの目安: プル数が多い、公式バッジが付いている組織・人 - [continuumio/miniconda3](https://hub.docker.com/r/continuumio/miniconda3) - [Bioconda](https://bioconda.github.io) - [rocker](https://hub.docker.com/u/rocker) - [Docker containers for Bioconductor](https://www.bioconductor.org/help/docker/) - Dockerコンテナを自作する - Dockerfileという名前のファイルを作成 ``` FROM alpine RUN apk add --update python3 py3-pip python3-dev CMD ["python3", "--version"] ``` - ```docker build -t 自分のユーザー名/イメージ名 .```(または単に```docker image -t 自分のユーザー名/イメージ名 .```)として、イメージを生成 - ```docker container run 自分のユーザー名/イメージ名 コマンド名 # 自作したイメージをコンテナ化 & 実行``` - ```docker image push # 自作したイメージをDockerHubに登録``` - **マウント(自分のPCのディレクトリとコンテナ内を接続する)** - ```docker container run --mount type=bind,source=${PWD},target=/temp alice/alpine-python python3 /temp/sum.py```(または単に```docker run -v $(pwd):/temp python3 /temp/sum.py```) - チャレンジ: マウントした後のコンテナ内部に対話モードで入る、ローカルファイルを触れるかチェック - ビルド時にイメージファイルの中にファイル(例: プログラム、データ)を入れる(`COPY`タグをDockerfile内で使う) - コンテナ内部にあるプログラムにパラメーターを渡したい - ❌ `CMD`だとコマンドとして解釈されてしまう - ⭕️ `ENTRYPOINT`タグを使う - `ENTRYPOINT`を設定したコンテナ内部には対話モードで簡単に入れない - `docker run -it`時に`--entrypoint /bin/sh`が別途必要 - Dockerfile集 - [joelnitta/pleurosoriopsis](https://github.com/joelnitta/pleurosoriopsis) - [joelnitta/targets_vcf_example](https://github.com/joelnitta/targets_vcf_example) - [kokitsuyuzaki/Dockerfiles](https://github.com/kokitsuyuzaki/Dockerfiles)

    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

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    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