Skip to content

Instantly share code, notes, and snippets.

@Foair
Last active June 20, 2022 03:28
Show Gist options
  • Save Foair/410531c82818c888344ac0928f8572bb to your computer and use it in GitHub Desktop.
Save Foair/410531c82818c888344ac0928f8572bb to your computer and use it in GitHub Desktop.
WSL
[wsl2]
memory=16GB
swap=0
# Advanced settings configuration in WSL
# https://docs.microsoft.com/en-us/windows/wsl/wsl-config
$gist= '410531c82818c888344ac0928f8572bb'
$api = "https://gist.githubusercontent.com/Foair/$gist/raw/"
$global_file = '.wslconfig'
$dist_file = 'wsl.conf'
curl.exe $api$global_file > ~/$global_file
wsl curl $api$dist_file `| sudo tee /etc/$dist_file
wsl --shutdown
#!/usr/bin/env bash
# How to Upgrade Git on Ubuntu 20.04 LTS - LinuxCapable
# https://www.linuxcapable.com/how-to-install-and-update-latest-git-on-ubuntu-20-04/
sudo add-apt-repository ppa:git-core/ppa -y
sudo apt update
sudo apt install git -y
# https://ohmyz.sh/#install
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# (reopen terminal)
vim ~/.zshrc
# https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
# change theme to "af-magic" ⬇️
# ZSH_THEME="af-magic"
# https://www.rust-lang.org/tools/install
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# https://github.com/nvm-sh/nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
# (reopen terminal)
nvm install --lts
# https://yarnpkg.com/getting-started/install
corepack enable
yarn --version
# https://github.com/cli/cli/blob/trunk/docs/install_linux.md
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh
# link to Windows side
# `(Get-Command pwsh).Path` in PowerShell
# or `where.exe pwsh` in both CMD and PowerShell
# `/usr/games/*` is another good choice to put these things
sudo ln -s /mnt/c/Windows/System32/clip.exe /usr/local/bin/scb
echo -e '#!/usr/bin/env bash\n/mnt/c/Program\ Files/PowerShell/7/pwsh.exe -c Get-Clipboard' | sudo tee /usr/local/bin/clip > /dev/null
sudo chmod +x /usr/local/bin/clip
sudo ln -s /mnt/c/Windows/explorer.exe /usr/local/bin/open
# `code` rather than `code.cmd`
sudo ln -s '/mnt/c/Users/$USER/AppData/Local/Programs/Microsoft VS Code/bin/code' /usr/games/code
[network]
hostname = lamb
[interop]
appendWindowsPath = false
@Foair
Copy link
Author

Foair commented Jun 20, 2022

pwsh.exe -c Get-Clipboard 可以不用 -c

Pipe from clipboard in linux subsytem for windows - Stack Overflow
https://stackoverflow.com/questions/55974462/pipe-from-clipboard-in-linux-subsytem-for-windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment