A set of bash, zsh, tmux, powershell, wsl, nodejs, msys2 configuration and script files.
These scripts only tested on my pc, laptop & cloud host and may not cover all cases, and may contain errors, use at your own RISK
!
Personal use only, make sure do a full test before using them in Production Environment
!
Best practice:
make a system backup
or prepare a live cd
before running these scripts!
Linux Distros what I daily use are Manjaro KDE Plasma
, Debian
, Centos Stream
, WSL2 on Windows 11
.
- Zsh as default shell
- Oh My Zsh to managing Zsh configuration
- ys theme for Zsh without Graphical Environment
- Oh My Posh theme for Zsh with Desktop Environment(KDE, GNOME, XFCE, WSL...)
- ZSH theme change script
- Zsh plugins
- Terminal Multiplexers: autostart Zellij/Tmux/Screen session on remote system when logging in via
SSH
Package managers
withpacman-style
command syntax- Unix commands
- fastfetch
- jq
- fzf
- Modern Unix
- ...
- Helper functions
- public: color echo, version compare...
- system: cron jobs, systemd services, snapper snapshots...
- osinfo: OS type, architecture, release, package manager, icon, virtualized...
- network: ipv4, ipv6, url, web service...
- proxy: get & set proxy
- git: clone, update git repos
- Git_Clone_Update clone or update a git repo:
Git_Clone_Update "username/repository" "$HOME/repository" # default host `https://github.com/` Git_Clone_Update "https://gitlab.com/username/repository" "$HOME/repository" # full repo url Git_Clone_Update "[email protected]:username/repository.git" "$HOME/repository"
- Git_Clone_Update_Branch clone or update a git repo only specified branch:
Git_Clone_Update_Branch "https://github.com/username/repository" "$HOME/repository" # auto get default branch Git_Clone_Update_Branch "username/repository" "$HOME/repository" "https://github.com" "dev" # dev branch
- Git_Update_Repo_in_SubDir update all git repos in subdirectories
Git_Update_Repo_in_SubDir "$ZSH/custom" # update all ZSH plugins & themes
- Git_Clone_Update clone or update a git repo:
- docker: docker mirrors, pull multiple images...
- installer: functions to install apps
- versions: version manager functions for goup, mise, asdf...
- web
- misc
- Scripts & functions to install apps
- Auto resolve download URL that match running platform, especially for apps release on
Github
- Speed up downloads with
axel
, if fails usecurl
instead - Automatically extract
executable
,man
,Zsh completions
files from compressed files and install to corresponding directories(/usr/local/bin
,/usr/share/man
,/usr/local/share/zsh/site-functions
)
installPrebuiltBinary rclone "rclone/rclone" # github releases installPrebuiltBinary nnn "jarun/nnn" "nnn-nerd-.*\.tar\.gz" # github releases installPrebuiltBinary earthly "earthly/earthly" "earthly-*" # github releases installPrebuiltBinary "https://dev.yorhel.nl/ncdu" "/download/ncdu-[^<>:;,?\"*|/]+\.tar\.gz" "ncdu-.*\.tar\.gz" # full URL
- Install app using brew, cargo, go...
installBuildBinary sd sd cargo installBuildBinary fvm fvm brew installBuildBinary protoc-gen-go protoc-gen-go go "google.golang.org/protobuf/cmd/protoc-gen-go@latest"
- Install apps using installer will set mirrors if the world blocked, you can override them in
~/.dotfiles.env.local
- Auto resolve download URL that match running platform, especially for apps release on
- Git configs
- Update apps that installed by app store or version managers
- alias for docker:
alias | grep '^docker'
- Auto setting environment variables for apps
- Snap
- Homebrew
- PHP
- Java
- Go
- Flutter
- Rust
- Python/pip
- nvm
- nvs
- Ruby
- krew
- Oracle Instant Client
- ...
Debian
distro upgradeCentOS Stream
distro upgrade- Custom environment variables in
~/.dotfiles.env.local
- Auto setting proxy if exists, use
127.0.0.1:7890
by defaultGLOBAL_PROXY_IP="127.0.0.1" GLOBAL_PROXY_SOCKS_PROTOCOL="socks5" GLOBAL_PROXY_SOCKS_PORT="7890" GLOBAL_PROXY_MIXED_PORT="7890" NO_PROXY_LIST=( "127.0.0.1" "::1" "localhost" ".corp" ".internal" ".local" ".localdomain" )
- git clone options
GIT_CLONE_DEFAULT_OPTION="-c core.autocrlf=false -c core.filemode=false"
- installer options
INSTALLER_CHECK_CURL_OPTION="-fsL --connect-timeout 5" INSTALLER_DOWNLOAD_CURL_OPTION="-fSL --connect-timeout 5" INSTALLER_DOWNLOAD_AXEL_OPTION="--num-connections=5 --timeout=30 --alternate"
- Github clone & download mirror
GITHUB_HUB_URL="https://github.com" GITHUB_DOWNLOAD_URL="https://github.com" GITHUB_RAW_URL="https://raw.githubusercontent.com" GITHUB_API_TOKEN=""
- mirrors
USE_MIRROR_WHEN_BLOCKED="true" # Debian MIRROR_PACKAGE_MANAGER_APT="mirror.sjtu.edu.cn" # Archlinux MIRROR_ARCHLINUX_CN="https://mirrors.sjtug.sjtu.edu.cn" # CentOS Stream MIRROR_CENTOS_STREAM="https://mirrors.aliyun.com/centos-stream" # Rockylinux MIRROR_ROCKYLINUX="https://mirrors.aliyun.com/rockylinux" MIRROR_EPEL_RELEASE="https://mirrors.aliyun.com" # homebrew HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git" HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git" HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles" HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api" # flatpak MIRROR_FLATPAK_URL="https://mirror.sjtu.edu.cn/flathub" # go GOUP_GO_HOST="golang.google.cn" MIRROR_GO_PROXY="https://goproxy.cn,direct" # MIRROR_GO_PROXY="https://goproxy.io,direct" # MIRROR_GO_PROXY="https://mirrors.aliyun.com/goproxy/,direct" # MIRROR_GO_PROXY="https://proxy.golang.org,direct" MIRROR_GO_SUMDB="sum.golang.google.cn" # MIRROR_GO_SUMDB="gosum.io+ce6e7565+AY5qEHUk/qmHc5btzW45JVoENfazw8LielDsaI+lEbq6" # MIRROR_GO_PRIVATE="*.corp.example.com" # flutter PUB_HOSTED_URL="https://pub.flutter-io.cn" FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn" # PUB_HOSTED_URL="https://mirror.sjtu.edu.cn/dart-pub" # FLUTTER_STORAGE_BASE_URL="https://mirror.sjtu.edu.cn" # rust RUSTUP_DIST_SERVER="https://rsproxy.cn" RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup" MIRROR_RUST_CARGO="rsproxy-sparse" # RUSTUP_DIST_SERVER="https://mirror.sjtu.edu.cn/rust-static" # RUSTUP_UPDATE_ROOT="https://mirror.sjtu.edu.cn/rust-static/rustup" # MIRROR_RUST_CARGO="sjtu" # nodejs MIRROR_NODEJS_REGISTRY="https://registry.npmmirror.com" MIRROR_NODEJS_DISTURL="https://npmmirror.com/dist" MIRROR_NODEJS_SASS_BINARY_SITE="https://npmmirror.com/mirrors/node-sass" MIRROR_NODEJS_ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/" # MIRROR_NODEJS_PUPPETEER_DOWNLOAD_HOST="https://npmmirror.com/mirrors" MIRROR_NODEJS_PUPPETEER_DOWNLOAD_BASE_URL="https://cdn.npmmirror.com/binaries/chrome-for-testing" MIRROR_NODEJS_CHROMEDRIVER_CDNURL="https://npmmirror.com/mirrors/chromedriver" MIRROR_NODEJS_OPERADRIVER_CDNURL="https://npmmirror.com/mirrors/operadriver" MIRROR_NODEJS_PHANTOMJS_CDNURL="https://npmmirror.com/mirrors/phantomjs" MIRROR_NODEJS_SELENIUM_CDNURL="https://npmmirror.com/mirrors/selenium" MIRROR_NODEJS_NODE_INSPECTOR_CDNURL="https://npmmirror.com/mirrors/node-inspector" # nvm NVM_NODEJS_ORG_MIRROR="https://npmmirror.com/mirrors/node" NVM_LOAD_NVMRC_IN_CURRENT_DIRECTORY=false # nvs NVS_NODEJS_ORG_MIRROR="https://npmmirror.com/mirrors/node" # python/pip PYTHON_PIP_CONFIG="$HOME/.pip/pip.conf" MIRROR_PYTHON_PIP_URL="https://mirrors.sustech.edu.cn/pypi/web/simple" MIRROR_PYTHON_PIP_EXTRA="" # anaconda MIRROR_PYTHON_CONDA="https://mirror.sjtu.edu.cn" # MIRROR_PYTHON_CONDA="https://mirror.sjtu.edu.cn" # MIRROR_PYTHON_CONDA="https://mirrors.tuna.tsinghua.edu.cn" # ruby RUBY_BUILD_MIRROR_URL="https://cache.ruby-china.com" RUBY_GEM_SOURCE_MIRROR="https://gems.ruby-china.com/" # lyx MIRROR_LYX_BASE="https://mirrors.tuna.tsinghua.edu.cn/lyx/"
- Install and/or update Apps
# Apps always install and update AppAlwaysInstallList=("asdf" "mise" "as-tree" "bat" "broot" "croc" "dasel" "duf" "dust" "erdtree" "eza" "fd" "git-delta" "lazygit" "lnav" "magic-wormhole" "navi" "nnn" "tealdeer" "yq" "zoxide") # Apps only install and update on WSL or Desktop environment AppWSLDesktopList=("bottom" "btop" "choose" "curlie" "distrobox" "dog" "fq" "fx" "git-lfs" "gotty" "httpie" "httpie-go" "httpstat" "hyperfine" "lsd" "nali" "ncdu" "nu" "onefetch" "ohmyposh" "poetry" "procs" "pup" "rclone" "re-txt" "restic" "sd" "tig" "usql" "viu" "wrk" "xh") # Apps only update when installed AppUpdateOnlyList=("frp" "goproxy" "he3" "safe-rm" "mihomo" "mieru" "mita" "subconverter" "sing-box" "flutter")
- Auto setting proxy if exists, use
BTRFS
filesystem- Encrypt
BTRFS
withLUKS2
- Enable Snap
- Enable Flatpak
- Enable AUR
bootsplash
themeSnapper
to take snapshots onBTRFS
GRUB
withSnapper
snapshots- Daily use apps
- Define variable
AppManjaroInstallList=(...)
in~/.dotfiles.env.local
for apps to install
- Define variable
Samba
SmartDNS
CJK
fontsFcitx5
input methodsRime
中州韻輸入法引擎Emoji
keyboardCUPS
: Printers, ScannerKVM
&QEMU
EmulatorConky
themes- Run Windows Applications with cassowary
- Run Windows Applications with winapps
- Arch Linux Chinese Community Repository if GEO in
China
- Auto setting proxy if exists, use
127.0.0.1:7890
by default - Accelerate the speed of
AUR PKGBUILD
if the world blocked- use
axel
to download, if fails usecurl
instead - if download from
github.com
, use env variableGITHUB_DOWNLOAD_URL
GITHUB_RAW_URL
if exists
- use
- Windows Terminal
- Powershell
- Modules
- Find-String
- Posh-git
- Terminal-Icons
- PSEverything
- PSFzf
- Get-ChildItemColor
- PoshFunctions
- Oh My Posh theme
- unix-style key bindings
- Tab Expansion with PSFzf
- Scoop to install apps
- Custom environment variables in
~/.powershell.env.ps1
- Auto setting proxy if exists, use
127.0.0.1:7890
by default$GLOBAL_PROXY_IP="127.0.0.1" $GLOBAL_PROXY_MIXED_PORT="7890" $GLOBAL_PROXY_HTTP_PORT="7890"
- Github clone & download mirror
$GITHUB_HUB_URL="https://github.com" $GITHUB_DOWNLOAD_URL="https://github.com" $GITHUB_RAW_URL="https://raw.githubusercontent.com"
- Helper functions
- ...
- Auto setting proxy if exists, use
- Modules
- WSL
- Base on
Debian
distro - All the features above for
Linux
- map host ip to wsl
- Base on
- MSYS2
- Use
npmmirror.com
fornpm
packages if the world blocked - pnpm to install
npm
packages - nvm to manager
node
versions - nvs to manager
node
versions npm-check-updates
to updatenpm
packages- A simple file server
- scripts for
openwrt
(test purpose)
- Script for
k8s
(test purpose)
CJK Text Optimization for Tampermonkey (unstable)
- Set
font-family
byhtml.lang
Noto
fonts forSC/TC/HK/JP/KR
localeemoji
for Emoji
- Add spaces between CJK characters and Latin letters
- Remove hidden obfuscated characters
- Code block pretty
- Element inspector to Screenshot
- Element inspector to Markdown
sudo pacman -S curl git
sudo apt-get install curl git
sudo dnf install curl git
...
source <(curl -fsSL --connect-timeout 5 --max-time 15 https://git.io/JPSue)
or
curl -fsSL --connect-timeout 5 --max-time 15 https://git.io/JPSue | bash "$HOME/.dotfiles"
${MY_SHELL_SCRIPTS:-$HOME/.dotfiles}/zsh/zsh_installer.sh
chsh -s $(which zsh)
${MY_SHELL_SCRIPTS:-$HOME/.dotfiles}/zsh/zsh_upgrade_all_packages.sh && ${MY_SHELL_SCRIPTS:-$HOME/.dotfiles}/zsh/zsh_init.sh
source <(curl -fsSL --connect-timeout 5 --max-time 15 https://git.io/JPSue) && ${MY_SHELL_SCRIPTS:-$HOME/.dotfiles}/zsh/zsh_upgrade_all_packages.sh
- Use
npm outdated
to discover dependencies that are out of date. - Use
npm update
to perform safe dependency upgrades. - Use
npm install <packagename>@latest
to upgrade to the latest major version of a package.
- Use
npm install -g npm-check
to install thenpm-check
package globally. - Use
npm-check -u -y
to upgrade all dependencies to their latest major versions.
Install Windows Terminal if running Windows 10
Windows 11
has built-in Windows Terminal
Install Powershell
curl -fsSL -o "~\pwsh_script_download.ps1" "https://git.io/JPS2j" && ~\pwsh_script_download.ps1
~\Documents\PowerShell\Scripts\Powershell_init.ps1
Edit file ~\Documents\PowerShell\Scripts\scoop_install_apps.ps1
to define the apps & fonts you want to install:
$Apps
- List of apps to install$sudoApps
- List of apps to install with administrative privileges$sudoFonts
- List of fonts to install with administrative privileges
~\Documents\PowerShell\Scripts\scoop_install_apps.ps1
- Install
WSL
distro
wsl --list --online
wsl --install -d Debian # or distro which your favor
wsl --update
- Open
WSL
distro - Follow the guide in
Install on Linux
${MY_SHELL_SCRIPTS:-$HOME/.dotfiles}/commitizen-relax_installer.sh
MIT