Day 93 of #100DaysOfLearning
Windows 11

Day 93 of #100DaysOfLearning

In order to make a clean break with the past, I did a clean install of Windows 11 and began to create a clean development environment from scratch.

Today we installed Windows Subsystem for Linux (WSL2) and then went as far as installing the Fish shell.

Here is what I did today.




1. Initial Setup

App Installer

If winget does not work, you should upgrade App Installer

Google Japanese IME

  • Installation

winget install Google.JapaneseIME        

Keymap Configuration

  1. Properties > Keymap Stype > Customize > Convert Hankaku/Zenkaku to Ctrl + Space
  2. Remove the followings:

  • Composition / Insert half-width space
  • Coversion / Insert half-width space

  1. You can use new keymaps after opening a new application

WSL

WSL2 is a Windows Subsystem for Linux that allows access to Linux tools and applications directly from the Windows environment12. It offers the best of both worlds by allowing you to run Windows apps, like Visual Studio, alongside a Linux shell for easier command line access2. WSL2 uses a virtual machine, and uses a full Linux kernel built and shipped with Windows23. With WSL2, you can build docker images that paravirtualize your GPU4.

  • Installation

Prepare for installation

Run as Administrator PowerShell and enable the following features:

  • VirtualMachinePlatform
  • Microsoft-Windows-Subsystem-Linux
  • HypervisorPlatform

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:HypervisorPlatform /all /norestart        

And restart

Restart-Computer -Force        

WSL Installation

wsl --install        

Upgrade packages

sudo apt update && sudo apt upgrade        

WSL Setup

Hostname

  • Configuration

sudo vim /etc/wsl.conf        

Add the followings:

[network]
hostname=wsl        

Then you should shutdown WSL with PowerShell.

wsl --shutdown        

Run your WSL again, now your configuration is enabled.

Other WSL Settings

SECTIONITEMSETTINGNOTEbootsystemdtrueEnable systemd supportnetworkhostname<YOUR_HOSTNAME>Hostname for your WSL InstanceinteropappendWindowsPathfalse / trueApped your Windows PATH or notuserdefault<YOUR_USERNAME>WSL Login Username

Terminal

Terminal settings:

Startup

  • Configuration
  • Default Profile: Ubuntu
  • Default Terminal Application: Terminal

Homebrew

Homebrew is an open-source software package manager that makes it easier to install software on macOS (Apple's operating system) and Linux. Basically, a package manager's job is to find and install the right software packages that will allow you to compile and run various apps/software on your specific operating system.

  • Installation

sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"        
(echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /home/shinyay/.bashrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
sudo apt-get install build-essential
brew install gcc
brew doctor        

Git

  • Installation

brew install git        
git --version
git version 2.44.0        

Git Global Configuration

  • Configuration

git config --global user.name "shinyay" && \
git config --global user.email "<YOUR_MAILADDRESS>" && \
git config --global core.quotepath false && \
git config --global core.safecrlf true && \
git config --global core.autocrlf false && \
git config --global core.editor 'vim -c "set fenc=utf-8"' && \
git config --global color.diff auto && \
git config --global color.status auto && \
git config --global color.branch auto && \
git config --global fetch.prune true && \
git config pull.ff only        

SSH Key for GitHub

Fine-grained personal access tokens

  • Generate new tokenRepository access: All repositoriesPermissions - Repository permissions - Contents: Read and write

ssh-keygen

  • Generate SSH Key pair

ssh-keygen -t ed25519 -C 'mail address for github'
cat $HOME/.ssh/id_ed25519.pub | clip.exe        

SSH Keys on GitHub

VSCode

Visual Studio Code, often referred to as VSCode, is a free and open-source code editor optimized for building and debugging modern web and cloud applications. It supports various programming languages and comes with features like IntelliSense for smart completions based on variable types, function definitions, and imported modules, built-in Git commands, and debugging tools. It's highly customizable and extensible with various extensions. It's available on multiple platforms including Linux, macOS, and Windows.

  • Installation

winget search vscode
winget install Microsoft.VisualStudioCode        

VSCode Extension

  • Installation

The Remote Development extension pack allows you to open any folder in a container, on a remote machine, or in the Windows Subsystem for Linux (WSL) and take advantage of VS Code's full feature set. Since this lets you set up a full-time development environment anywhere.
sudo apt-get install wget ca-certificates        

The following extesions are also installed:

2. WSL Customization

WSL

Update and Upgrade packages.

  • Configuration

sudo apt update && sudo apt upgrade
brew update && brew upgrade        

Requred Packages Installation

Basic Packages

  • Installation
  • zip
  • unzip

brew install zip unzip        

Fontconfig

  • Installation

Fontconfig is a library designed to provide system-wide font configuration, customization and application access.

sudo apt-get install fontconfig        

wslu

  • Installation

This is a collection of utilities for the Windows Subsystem for Linux (WSL), such as converting Linux paths to Windows paths or creating Linux application shortcuts on the Windows Desktop.

sudo apt-get install wslu        

Commands list:

dpkg -L wslu | grep bin/        

Git

Git Alias

List aliases:

git config --get-regexp ^alias\.        

Alias for Alias list

  • Configuration

git config --global alias.alias 'config --get-regexp ^alias\.'        

git status

  • Configuration

git config --global alias.st 'status --short        

git log

  • Configuration

git config --global alias.plog "log --pretty='format:%C(yellow)%h %C(green)%cd %C(reset)%s %C(red)%d %C(cyan)[%an]' --date=iso"
git config --global alias.glog "log --pretty='format:%C(yellow)%h %C(green)%cd %C(reset)%s %C(red)%d %C(cyan)[%an]' --date=format:'%c' --all --graph"        

Commit Count

  • Configuration

git config --global alias.count 'shortlog -e -s -n'        

GitHub CLI

  • Installation

GitHub CLI, or gh, is a command-line interface to GitHub for use in your terminal or your scripts.

brew install gh        
gh --version

gh version 2.46.0 (2024-03-20)
https://github.com/cli/cli/releases/tag/v2.46.0        

GitHub Authentication

gh auth login

? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations on this host? SSH
? Upload your SSH public key to your GitHub account? $HOME/.ssh/id_ed25519.pub
? Title for your SSH key: GitHub CLI
? How would you like to authenticate GitHub CLI? Login with a web browser        

Text editor program to use for authoring text

gh config set editor vim        

Fish

Fish, or the "Friendly Interactive SHell", is a Unix shell designed with an emphasis on user-friendliness and interactive use. It was introduced in 2005 and has since gained a following due to its unique features, helpful defaults, and focus on a pleasant user experience.

Fish Install

  • Installation

brew install fish        

Check the PATH for fish.

which fish

/home/linuxbrew/.linuxbrew/bin/fish        

Write the PATH for fish to define the valid shell.

sudo sh -c "echo /home/linuxbrew/.linuxbrew/bin/fish >> /etc/shells"        

Define fish as a Default Shell.

chsh -s /home/linuxbrew/.linuxbrew/bin/fish        

Reboot WSL and check fish.

echo $SHELL        

Define the PATH of brew on fish.

echo 'eval (/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >> $HOME/.config/fish/config.fish        

Check brew doctor.

brew doctor        

Fisher

Fisher is a plugin manager for the Fish shell. It lets you install, update, and remove plugins like a boss. You can take control of functions, completions, bindings, and snippets from the command line. Fisher's zero impact on shell startup keeps your shell zippy and responsive1. Fisher is 100% pure-Fish, making it easy to contribute or modify.

curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher        
fisher -v
fisher, version 4.4.4        

Fish Theme - bobthefish

fisher install oh-my-fish/theme-bobthefish        

bobthefish Configuration

  • Configuration

vim $HOME/.config/fish/config.fish

set -g theme_display_git_master_branch yes
set -g theme_display_git yes
set -g theme_display_git_dirty yes
set -g theme_display_git_untracked yes
set -g theme_display_git_ahead_verbose yes
set -g theme_display_git_dirty_verbose yes
set -g theme_display_git_stashed_verbose yes
set -g theme_git_worktree_support no
set -g theme_use_abbreviated_branch_name no

set -g theme_display_vagrant no
set -g theme_display_docker_machine no
set -g theme_display_k8s_context no
set -g theme_display_hg no
set -g theme_display_virtualenv no
set -g theme_display_nix no
set -g theme_display_ruby no
set -g theme_display_nvm no
set -g theme_display_user ssh
set -g theme_display_hostname ssh
set -g theme_display_vi no
set -g theme_display_date yes
set -g theme_display_cmd_duration yes

set -g theme_title_display_process no
set -g theme_title_display_path yes
set -g theme_title_display_user no
set -g theme_title_use_abbreviated_path no

set -g theme_date_format "+%F %H:%M"
set -g theme_date_timezone Asia/Tokyo
set -g theme_avoid_ambiguous_glyphs yes
set -g theme_powerline_fonts yes
set -g theme_nerd_fonts no
set -g theme_show_exit_status yes
set -g theme_display_jobs_verbose yes
set -g default_user your_normal_user
set -g theme_color_scheme loght
set -g fish_prompt_pwd_dir_length 0
set -g theme_project_dir_length 1
set -g theme_newline_cursor yes
set -g theme_newline_prompt ''        

Moralerspace font for bobthefish

mkdir download && cd download
curl -L -O https://github.com/yuru7/moralerspace/releases/download/v1.0.0/MoralerspaceHWJPDOC_v1.0.0.zip
curl -L -O https://github.com/yuru7/moralerspace/releases/download/v1.0.0/MoralerspaceHWNF_v1.0.0.zip
curl -L -O https://github.com/yuru7/moralerspace/releases/download/v1.0.0/MoralerspaceHW_v1.0.0.zip
curl -L -O https://github.com/yuru7/moralerspace/releases/download/v1.0.0/MoralerspaceJPDOC_v1.0.0.zip
curl -L -O https://github.com/yuru7/moralerspace/releases/download/v1.0.0/MoralerspaceNF_v1.0.0.zip
curl -L -O https://github.com/yuru7/moralerspace/releases/download/v1.0.0/Moralerspace_v1.0.0.zip
unzip MoralerspaceHWJPDOC_v1.0.0.zip
unzip MoralerspaceHWNF_v1.0.0.zip
unzip MoralerspaceHW_v1.0.0.zip
unzip MoralerspaceJPDOC_v1.0.0.zip
unzip MoralerspaceNF_v1.0.0.zip
unzip Moralerspace_v1.0.0.zip
sudo mkdir  /usr/share/fonts/truetype/moralerspace
sudo cp MoralerspaceHWJPDOC_v1.0.0/*.ttf /usr/share/fonts/truetype/moralerspace/
sudo cp MoralerspaceHWNF_v1.0.0/*.ttf /usr/share/fonts/truetype/moralerspace/
sudo cp MoralerspaceHW_v1.0.0/*.ttf /usr/share/fonts/truetype/moralerspace/
sudo cp MoralerspaceJPDOC_v1.0.0/*.ttf /usr/share/fonts/truetype/moralerspace/
sudo cp MoralerspaceNF_v1.0.0/*.ttf /usr/share/fonts/truetype/moralerspace/
sudo cp Moralerspace_v1.0.0/*.ttf /usr/share/fonts/truetype/moralerspace/
sudo fc-cache -vf
fc-list | grep -i moralerspace
explorer.exe .        

Then install *ttf.

  1. Open settings: ctrl + ,
  2. Select Ubuntu
  3. Select Aditional settings > Appearance
  4. Choose Moralerspace Radon NF from Font face

Then delete downloaded fonts.

cd ..
rm -fr download        

I used to install compilers and runtimes for various programming languages in the local environment of my PC, but this time I am planning to utilize Dev Containers to keep the local environment as clean as possible. This way, I can ensure the continuity and continuity of the development environment without any problems even if I move to a different PC in the future.

It will take some time to complete the environment at hand, but I hope to have it done by the end of this week.

But it is always fun to set up a new development environment, even if it is time consuming.

要查看或添加评论,请登录

Shinya Yanagihara的更多文章

  • Day 100 of #100DaysOfLearning

    Day 100 of #100DaysOfLearning

    I have mixed feelings about it, as if it was long and short. This is finally the 100th activity that I started with the…

    1 条评论
  • Day 99 of #100DaysOfLearning

    Day 99 of #100DaysOfLearning

    What a surprise! I found myself on the 99th day of the 100Days of Learning activity. Continuation is power, indeed.

  • Day 98 of #100DaysOfLearning

    Day 98 of #100DaysOfLearning

    How do you take notes when you study? There are some note-taking systems and techniques, such as Cornell note-taking…

  • Day 97 of #100DaysOfLearning

    Day 97 of #100DaysOfLearning

    Today is the fourth day of setting up a Windows environment. Today I finally get to set up my long-awaited development…

  • Day 96 of #100DaysOfLearning

    Day 96 of #100DaysOfLearning

    I am sure you are all aware that open source also has a license. I knew that, but I always managed my GitHub…

  • Day 95 of #100DaysOfLearning

    Day 95 of #100DaysOfLearning

    Today is the third day of building a new PC environment. Today I was mainly working on the configuration of Visual…

    2 条评论
  • Day 94 of #100DaysOfLearning

    Day 94 of #100DaysOfLearning

    It is no exaggeration to say that Windows is now Linux. I'm sure some of you don't know what I mean.

    2 条评论
  • Day 92 of #100DaysOfLearning

    Day 92 of #100DaysOfLearning

    Happy April Fool's Day! Today is April 1, which is April Fool's Day. Some of you may have been looking forward to April…

  • Day 91 of #100DaysOfLearning

    Day 91 of #100DaysOfLearning

    I actually haven't used a Mac since I left my last job and entered my career break period. I use Windows every day.

  • Day 90 of #100DaysOfLearning

    Day 90 of #100DaysOfLearning

    Software development can be a peaceful or thorny path, depending on one's approach. Now, many of you know that when it…

社区洞察

其他会员也浏览了