お知らせ

現在サイトのリニューアル作業中のため、全体的にページの表示が乱れています。
投稿日:
ソフトウェア::WSL

環境

Env Ver
Windows 11 Pro Build 22621.674
Ubuntu 22.04.01

ベースのセットアップ

  1. wsl --update
  2. Microsoft StoreからUbuntu 22.04.01 LTSをインストール
    1. GUIのウィザードがコケたらやり直す
  3. /etc/wsl.confに起動設定を追加
    1. リファレンス:learn.microsoft.com
[boot]
systemd=true

[user]
default=<ユーザー名>
  1. wsl --shutdown
  2. Ubuntuのコンソールを開きデフォルトユーザーが設定通りなのを確認
  3. アップデート
sudo apt update
sudo apt upgrade

開発環境のセットアップ

  1. 以下を流す
sudo apt install -y \
    zsh \
    ssh \
    net-tools \
    git \
    unzip \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
# Docker公式のGPG鍵を追加
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# リポジトリをパッケージマネージャーに登録
echo 
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu 
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# docker本体のインストール
sudo apt install -y \
    docker-ce \
    docker-ce-cli \
    containerd.io \
    docker-compose-plugin
# 一般ユーザーで docker を利用可能にする
sudo usermod -aG docker $USER
# Node.js
curl https://get.volta.sh | bash
# zsh切り替え
chsh -s $(which zsh)
  1. ターミナル再起動
# zsh設定取り込み
git clone https://github.com/Lycolia/my-zsh-conf.git
rm -Rf my-zsh-conf/.git/
mv my-zsh-conf/.* .
rm -Rf my-zsh-conf/
# install Node.js
volta install node@lts
  1. ターミナル再起動してzsh設定の反映を確認

ログイン時と非ログイン時でコードブロックの改行が変化し、見た目が破綻する問題に気がついたので解決法

問題の事象

ログイン状態だと正常に表示されるが、非ログイン状態だとスーパーリロードなどをすると表示が壊れる

ログイン時 非ログイン時
正常表示
破綻した表示

問題の原因と解決策

非ログイン時にHTML上から改行コードが消えるのが問題でした

解決策としてはダッシュボードからSANGO設定高速化HTMLを圧縮してキャッシュするのチェックを外せば解消します

解決したときの設定画面

投稿日:
ソフトウェア::WSL

ユーザー名を変更したいときに使えるが、ほぼ力技。きっともっと楽な方法があるはず。

確認環境

Env Ver
WSL Distri Ubuntu 20.04.4 LTS

手順

WSL内でユーザーを作る

sudo useradd new_user
sudo cp -R /home/old_user /home/new_user
# 細かい権限はどうにかするかフィルタして旧ユーザーのみ変える
chown -R new_user:new_user new_user/
# 新ユーザーのPWを設定
sudo passwd new_user
# sudo出来るようにする
sudo gpasswd -a new_user sudo

Ubuntuのデフォルトユーザーを変更する

<ディストリ名> config --default-user new_user
投稿日:
ソフトウェア::VSCode
{
  "terminal.integrated.defaultProfile.windows": "MSYS2",
  "terminal.integrated.profiles.windows": {
    "MSYS2": {
      "overrideName": true,
      "path": ["C:\\env\\msys64\\msys2_shell.cmd"],
      "args": [
        "-defterm",
        "-here",
        "-use-full-path",
        "-no-start",
        "-mingw64",
        "-shell",
        "zsh"
      ]
    },
    "PowerShell": {
      "source": "PowerShell",
      "icon": "terminal-powershell"
    },
    "Command Prompt": {
      "path": [
        "${env:windir}\\Sysnative\\cmd.exe",
        "${env:windir}\\System32\\cmd.exe"
      ],
      "args": [],
      "icon": "terminal-cmd"
    }
  },
  "terminal.integrated.defaultProfile.linux": "zsh",
  "terminal.integrated.profiles.linux": {
    "zsh": {
      "path": "zsh"
    },
    "bash": {
      "path": "bash"
    }
  },
  "terminal.integrated.automationProfile.windows": {
    "path": "${env:windir}\\System32\\cmd.exe",
    "args": [],
    "icon": "terminal-cmd"
  },
  "terminal.integrated.allowChords": false,
  "terminal.integrated.commandsToSkipShell": [
    "-workbench.action.quickOpenView",
    "-workbench.action.terminal.focusFind"
  ],
  "workbench.startupEditor": "newUntitledFile",
  "workbench.iconTheme": "vscode-icons",
  "workbench.editor.decorations.badges": false,
  "workbench.editor.decorations.colors": false,
  "workbench.tree.enableStickyScroll": false,
  "workbench.layoutControl.enabled": false,
  "workbench.editor.empty.hint": "hidden",
  "files.eol": "\n",
  "files.trimTrailingWhitespace": true,
  "files.insertFinalNewline": true,
  "scm.showIncomingChanges": "never",
  "scm.showOutgoingChanges": "never",
  "git.autorefresh": true,
  "git.autoStash": true,
  "git.suggestSmartCommit": false,
  "git.mergeEditor": false,
  "git.openRepositoryInParentFolders": "never",
  "remote.autoForwardPortsSource": "hybrid",
  "diffEditor.ignoreTrimWhitespace": true,
  "diffEditor.renderGutterMenu": false,
  "explorer.confirmDragAndDrop": false,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit"
  },
  "editor.stickyScroll.enabled": false,
  "[markdown]": {
    "editor.tabSize": 4,
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": true
  },
  "php.validate.run": "onSave",
  "vsicons.dontShowNewVersionMessage": true,
  "pasteImage.path": "${currentFileDir}/${currentFileNameWithoutExt}.assets",
  "todo-tree.filtering.excludeGlobs": ["**/node_modules/**/*"],
  "todo-tree.highlights.customHighlight": {
    "TODO": {
      "foreground": "#f8ff96",
      "type": "text-and-comment"
    },
    "FIXME": {
      "foreground": "#ff9696",
      "type": "text-and-comment"
    }
  },
  "todo-tree.general.tags": ["TODO", "FIXME"],
  "todo-tree.regex.regex": "(//|#|<!--|/\\*|^\\s*\\*)\\s*($TAGS)",
  "gitlens.currentLine.format": "${author, }${date}${' via 'pullRequest}${ • message|50?}",
  "gitlens.statusBar.format": "${author}, ${date}${' via 'pullRequest}",
  "gitlens.statusBar.tooltipFormat": "${avatar} &nbsp;__${author}__, ${date}${' via 'pullRequest}\n\n${message}${\n\n---\n\nfootnotes}\n\n${commands}",
  "gitlens.hovers.detailsMarkdownFormat": "${avatar} &nbsp;__${author}__, ${date}${' via 'pullRequest}\n\n${message}${\n\n---\n\nfootnotes}\n\n${commands}",
  "gitlens.views.formats.stashes.description": "${date}",
  "gitlens.views.formats.commits.description": "${author, }${date}",
  "gitlens.defaultDateFormat": "YYYY-MM-DD",
  "terminal.integrated.shellIntegration.decorationsEnabled": "never",
  "security.workspace.trust.untrustedFiles": "open",
  "explorer.copyRelativePathSeparator": "/",
  "typescript.tsserver.log": "off",
  "gitlens.ai.experimental.generateCommitMessage.enabled": false,
  "redhat.telemetry.enabled": true
}