Created
February 23, 2021 07:22
-
-
Save secf4ult/6f0b81c95219353807dec1ab0265ef51 to your computer and use it in GitHub Desktop.
Environment setup scripts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Getting Ready | |
LOGDIR="~/log" | |
DOTFILES="~/.dotfiles" | |
# Update & Upgrade | |
sudo apt-get update -y | |
sudo apt-get upgrade -y | |
# Setup Prerequisite | |
sudo apt install -qy software-properties-common build-essential autotools \ | |
install-info wget curl man git sqlite3 openssl llvm make \ | |
sudo apt install -qy libssl-dev libbz2-dev libsqlite3-dev libreadline-dev \ | |
zlib1g-dev libncurses5-dev libncursesw5-dev xz-utils \ | |
tk-dev libffi-dev liblzma-dev python-openssl libssl1.0-dev | |
# Setup git | |
git config --global user.email "[email protected]" | |
git config --global user.name "secf4ult" | |
# Clone dotfiles | |
if [[! -d ~/.dotfiles ]];then | |
git clone https://github.com/secf4ult/dotfiles ~/.dotfiles | |
cd ~/.dotfiles && git submodule update --init --recursive --remote | |
fi | |
# Create folders | |
mkdir ~/local | |
mkdir ~/projects | |
mkdir ~/log | |
export PATH=$PATH:~/local/bin | |
# If system is wsl | |
# Setup wsl.conf | |
if grep -q Microsoft /proc/version; then | |
mkdir ~/windir | |
sudo ln -fs ~/.dotfiles/wsl.conf /etc/wsl.conf | |
sudo ln -fs /mnt/d ~/windir/d | |
code -v >/dev/null | |
fi | |
# Setup Bash | |
ln -fs ~/.dotfiles/.bashrc ~/.bashrc | |
ln -fs ~/.dotfiles/.bash_prompt ~/.bash_prompt | |
ln -fs ~/.dotfiles/.bash_profile ~/.bash_profile | |
ln -fs ~/.dotfiles/.bash_aliases ~/.bash_aliases | |
# Setup Zsh | |
## Setup zsh | |
cd ~/tmp && curl -L -o zsh.tar.xz "https://sourceforge.net/projects/zsh/files/latest/download" | |
tar xf zsh.tar.xz | |
cd ~/tmp/zsh-* | |
./configure --prefix="$HOME/local" CPPFLAGS="-I$HOME/local/include" \ | |
LDFLAGS="-L$HOME/local/lib" | |
make -j >~/log/zsh.make.log && make install >~/log/zsh.install.log | |
## Setup Oh-my-zsh | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" >~/log/oh-my-zsh.log | |
ln -fs ~/.dotfiles/.zshrc ~/.zshrc | |
ln -fs ~/.dotfiles/.zshenv ~/.zshenv | |
# Setup Utilities | |
## Setup Vim | |
git clone --depth 1 https://github.com/vim/vim.git ~/tmp/vim/src | |
cd ~/tmp/vim/src | |
make --silent | |
sudo make install --silent | |
### link vim | |
ln -fs ~/.dotfiles/.vimrc ~/.vimrc | |
### install vundle | |
git clone --depth 1 https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
cd | |
## Setup Tmux | |
git clone --depth 1 https://github.com/tmux/tmux.git ~/tmp/tmux | |
cd ~/tmp/tmux | |
sh autogen.sh >$LOGDIR/tmux.autogen.log | |
./configure >$LOGDIR/tmux.conf.log && make >$LOGDIR/tmux | |
### tpm | |
git clone --depth 1 https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm | |
ln -fs ~/.dotfiles/.tmux.conf ~/.tmux.conf | |
## Setup Sqlite | |
ln -fs ~/.dotfiles/.sqliterc ~/.sqliterc | |
## Setup screenfetch | |
cd ~/local/bin && curl -LO https://raw.githubusercontent.com/KittyKatt/screenFetch/master/screenfetch-dev | |
chmod u+x ~/local/bin/screenfetch | |
## Setup rbenv | |
git clone https://github.com/rbenv/rbenv.git ~/.rbenv | |
cd ~/.rbenv && src/configure && make -C src | |
mkdir -p ~/.rbenv/plugins | |
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build | |
## Setup pyenv | |
git clone https://github.com/pyenv/pyenv.git ~/.pyenv | |
## Setup nodenv | |
git clone https://github.com/nodenv/nodenv.git ~/.nodenv | |
cd ~/.nodenv && src/configure && make -C src | |
mkdir -p ~/.nodenv/plugins | |
git clone https://github.com/nodenv/node-build.git ~/.nodenv/plugins/node-build | |
### Setup ripgrep | |
cd ~/tmp && curl -sLO $(curl -s https://api.github.com/repos/BurntSushi/ripgrep/releases/latest | grep browser_download_url.*amd64 | cut -d'"' -f4) | |
sudo dpkg -i ripgrep* | |
### Setup aria2 | |
sudo apt install aria2 | |
md ~/.aria2 | |
ln -fs $DOTFILES/aria2/aria2.conf ~/.aria2/aria2.conf | |
# Cleaning | |
## Delete tmp folder | |
rm -rf ~/tmp | |
sudo apt clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup homebrew | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
# Setup Essential | |
brew install wget curl sqlite3 openssl xz zlib git | |
# Setup git | |
git config --global user.name secf4ult | |
git config --global user.email "[email protected]" | |
# Clone dotfiles | |
git clone https://github.com/secf4ult/dotfiles $HOME/.dotfiles | |
DOTFILES="$HOME/.dotfiles" | |
# Setup development environment | |
# Setup nodenv, pyenv, rbenv | |
brew install nodenv | |
brew install pyenv | |
brew install rbenv | |
# Setup rust | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | |
# Setup zsh | |
brew install zsh | |
ln -fs $DOTFILES/.zshrc $HOME/.zshrc | |
ln -fs $DOTFILES/.zshenv $HOME/.zshenv | |
ln -fs $DOTFILES/.p10k.zsh $HOME/.p10k.zsh | |
# Setup tmux | |
brew install tmux | |
ln -fs $DOTFILES/.tmux_conf $HOME/.tmux.conf | |
# Setup vim | |
ln -fs $DOTFILES/.vimrc $HOME/.vimrc | |
# Setup vundle | |
git clone --depth 1 https://github.com/VundleVim/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim | |
# Setup docker | |
brew install docker | |
# Setup fonts | |
brew tap homebrew/cask-fonts | |
brew cask install font-meslo-nerd-font-mono font-firacode-nerd-font | |
# Setup apps | |
brew install ripgrep | |
# Setup aria2 | |
brew install aria2c | |
mkdir -p $HOME/.aria2 | |
ln -fs $DOTFILES/aria2/aria2.conf $HOME/.aria2/aria2.conf | |
# Setup gui apps | |
bred tap homebrew/cask-versions | |
brew cask install firefox-developer-edition visual-studio-code clashx \ | |
microsoft-edge-dev google-chrome-dev wireshark postman \ | |
safari-technology-preview iterm2 mpv java | |
# Setup vscode | |
mkdir -p $HOME/Library/Application\ Support/Code/User | |
ln -fs DOTFILES/vscode/settings $HOME/Library/Application\ Support/Code/User/settings.json | |
# Setup clashx | |
mkdir -p $HOME/.config/clash | |
ln -fs DOTFILES/clash/clashx-mac.yaml $HOME/.config/clash/clashx-mac.yaml | |
# Setup mpv | |
mkdir -p $HOME/.config/mpv | |
ln -fs DOTFILES/mpv/mpv.conf $HOME/.config/mpv/mpv.conf | |
ln -fs DOTFILES/mpv/input.conf $HOME/.config/mpv/input.conf | |
# Setup transmission | |
brew cask install transmission |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Description: Setup Windows 10 environment | |
# Author: secf4ult | |
# Last Update: 2018-4-6 | |
# | |
# Modified from https://gist.github.com/jessfraz/7c319b046daa101a4aaef937a20ff41f | |
Set-ExecutionPolicy Unrestricted -Force | |
# ---- Install Scoop ---- | |
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') | |
# Disable-UAC | |
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableLUA -Value 0 | |
# ---- WINDOWS SETTINGS ---- | |
# UNINSTALL | |
Get-AppxPackage Microsoft.WindowsMaps | Remove-AppxPackage | |
Get-AppxPackage Microsoft.WindowsAlarms | Remove-AppxPackage | |
Get-AppxPackage Microsoft.WindowsSoundRecorder | Remove-AppxPackage | |
Get-AppxPackage Microsoft.Messaging | Remove-AppxPackage | |
Get-AppxPackage Microsoft.ZuneMusic | Remove-AppxPackage | |
Get-AppxPackage Microsoft.ZuneVideo | Remove-AppxPackage | |
Get-AppxPackage Microsoft.BingWeather | Remove-AppxPackage | |
Get-AppxPackage Microsoft.MSPaint | Remove-AppxPackage | |
Get-AppxPackage Microsoft.WindowsCamera | Remove-AppxPackage | |
Get-AppxPackage Microsoft.ImmersiveReader | Remove-AppxPackage | |
# File Explorer: | |
# Displays file extentsion | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name HideFileExt -Type DWord -Value 0 | |
# Displays hidden files, folders, and drives | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowSuperHidden -Type DWord -Value 1 | |
# Displays protected operating system files | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name Hidden -Type DWord -Value 1 | |
# Displays the full path in the title bar | |
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState -Name FullPath -Type DWord -Value 1 | |
# Change Explorer home screen back to "This PC" | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Type DWord -Value 1 | |
# Expand navigation pane to current folder | |
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneExpandToCurrentFolder -Type DWord -Value 1 | |
# Taskbar: | |
# Taskbar small icons | |
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name TaskbarSmallIcons -Type DWord | |
# Dock taskbar top | |
# from: https://github.com/chocolatey/boxstarter/blob/master/Boxstarter.WinConfig/Set-TaskbarOptions.ps1 | |
# the 9th byte in StuckRects?/Settings controls taskbar, for what meaning every bit represents refer to: http://www.dabcc.com/deciphering-stuckrects2/ | |
$dockingKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2' | |
if(-not (Test-Path -Path $dockingKey)) { | |
$dockingKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3' | |
} | |
Set-ItemProperty -Path $dockingKey -Name Settings -Value ([byte[]] (0x28,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x2e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x07,0x00,0x00,0x2e,0x00,0x00,0x00)) | |
# Start Menu | |
# Disable Bing Search Results | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Name BingSearchEnabled -Type DWord -Value 0 | |
# Enable Developer Mode | |
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock -Name AllowDevelopmentWithoutDevLicense -Type DWORD -Value 1 | |
#--- Apps --- | |
scoop install aria2 | |
scoop install sudo grep sed less touch ln curl wget | |
scoop install git 7zip openssh nmap docker | |
# font | |
scoop bucket add nerd-fonts | |
scoop install FiraCode-NF Meslo-NF | |
# nirsoft | |
scoop bucket add nirsoft | |
# scoop install | |
# java | |
scoop bucket add java | |
scoop install openjdk | |
# gui apps | |
scoop bucket add extras | |
scoop install chromium-dev-nosync firefox-developer mpv wireshark steam vscodium-portable | |
# # Setup Powershell | |
# Install-Module -Name PowerShellGet -Force | |
# Install-Module -Name posh-git -Scope CurrentUser -Force | |
# Install-Module -Name oh-my-posh -Scope CurrentUser -Force | |
# ---- Restore Temporary Settings ---- | |
# Enable-UAC | |
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableLUA -Value 1 | |
# Enable-MicrosoftUpdate | |
# Install-WindowsUpdate -acceptEula | |
Set-ExecutionPolicy RemoteSigned -Force | |
# Config the scoop | |
scoop config proxy 127.0.0.1:7890 | |
# Config powershell | |
scoop install concfg | |
concfg import solarized-dark -y | |
# ---- Rename the Computer ---- | |
# Requires restart, or add the -Restart flag | |
$computername = "secf4ult" | |
if ($env:computername -ne $computername) { | |
Rename-Computer -NewName $computername | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment