Skip to content

Instantly share code, notes, and snippets.

@aphex
Last active May 10, 2022 02:02
Show Gist options
  • Save aphex/dbb47ec1ecd452ea06de04d1bc91e737 to your computer and use it in GitHub Desktop.
Save aphex/dbb47ec1ecd452ea06de04d1bc91e737 to your computer and use it in GitHub Desktop.
#!/bin/bash
print() {
echo -e "\e[34m${1}\e[0m"
}
print "GIT user.name?"
read git_config_user_name
print "GIT user.email?"
read git_config_user_email
print "Installing NVM"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
# Load up nvm & yarn paths
. ~/.nvm/nvm.sh
. ~/.profile
. ~/.bashrc
# create user folder for global binaries
mkdir -p ~/.local/bin
print "Updating APT"
sudo apt update
print "Installing NodeJS LTS"
nvm install --lts
print "Installing git"
sudo apt install -y git
print "Installing unzip"
sudo apt install -y unzip
print "Installing FiraCode"
sudo apt install fonts-firacode -y
print "Installing htop (Process Viewer)"
sudo apt install htop -y
# Replace this with apt-get when we cna use Ubuntu 20.10
print "Installing exa (LS replacement)"
cd ~
wget https://github.com/ogham/exa/releases/download/v0.10.1/exa-linux-x86_64-v0.10.1.zip
unzip exa-linux-x86_64-v0.10.1.zip -d exa
mv ~/exa/bin/exa ~/.local/bin/
rm -rf ~/exa ~/exa-linux-x86_64-v0.10.1.zip
print "Installing fx (JSON Viewer)"
cd ~
wget https://github.com/antonmedv/fx/releases/download/20.0.2/fx-linux.zip
unzip fx-linux.zip -d fx
mv ~/fx/fx-linux ~/.local/bin/fx
rm -rf ~/fx ~/fx-linux.zip
print "Installing fd (find replacement used by fzf"
sudo apt-get install fd-find -y
ln -s $(which fdfind) ~/.local/bin/fs
print "Installing bat (cat replacement)"
sudo apt install bat -y
ln -s /usr/bin/batcat ~/.local/bin/bat
# Currently conflicts with bat, should be fixed in 20.1
print "Installing hexyl (hex viewer)"
sudo apt install -o Dpkg::Options::="--force-overwrite" bat hexyl -y
print "Installing diff-so-fancy (fancy diff /w git integration)"
sudo add-apt-repository ppa:aos1/diff-so-fancy -y
sudo apt-get update
sudo apt-get install diff-so-fancy -y
git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX"
git config --global interactive.diffFilter "diff-so-fancy --patch"
git config --global color.ui true
git config --global color.diff-highlight.oldNormal "red bold"
git config --global color.diff-highlight.oldHighlight "red bold 52"
git config --global color.diff-highlight.newNormal "green bold"
git config --global color.diff-highlight.newHighlight "green bold 22"
git config --global color.diff.meta "11"
git config --global color.diff.frag "magenta bold"
git config --global color.diff.func "146 bold"
git config --global color.diff.commit "yellow bold"
git config --global color.diff.old "red bold"
git config --global color.diff.new "green bold"
git config --global color.diff.whitespace "red reverse"
print "Installing fzf (fuzzy search)"
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install --completion --key-bindings --update-rc
print "Installing DotNet 5 runtime & wine"
# Adding MS Keys
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo rm packages-microsoft-prod.deb
# Adding i386 arch for wine
sudo dpkg --add-architecture i386
# update
sudo apt update
# dotnet install
sudo apt install -y dotnet-runtime-5.0
# dotnet install
sudo apt install wine32 wine64
print "Installing Vim Dracula Theme"
mkdir -p ~/.vim/pack/themes/start
cd ~/.vim/pack/themes/start
git clone https://github.com/dracula/vim.git dracula
cd ~
print "Setting up git global user name and email"
git config --global user.name "$git_config_user_name"
git config --global user.email $git_config_user_email
if [ ! -f ~/.ssh/id_ed25519 ]; then
print "Generating a SSH Key"
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -q -N "" -C "$email"
ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub | xclip -selection clipboard
fi
print "Writing vim Config"
cat <<EOF > ~/.vimrc
set termguicolors
packadd! dracula
syntax enable
colorscheme dracula
EOF
print "Cloning tmux Plugin Manager"
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
print "Writing tmux Config"
cat <<EOF > ~/.tmux.conf
set -g mouse on
set -g default-terminal "xterm-256color"
set -g @plugin 'tmux-plugins/tpm'
set -g @dracula-show-network false
set -g @dracula-show-battery false
set -g @dracula-cpu-usage false
set -g @dracula-ram-usage false
set -g @dracula-gpu-usage false
set -g @dracula-show-left-icon ๐Ÿ’€
set -g @dracula-show-weather false
set -g @dracula-show-timezone false
set -g @dracula-show-powerline false
set -g @plugin 'dracula/tmux'
run -b '~/.tmux/plugins/tpm/tpm'
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
EOF
print "Installing Fish Shell"
sudo apt-add-repository ppa:fish-shell/release-3 -y
sudo apt update
sudo apt install -y fish
print "Running Fish Shell"
fish
print "Adding Home bin to path to fish"
fish_add_path ~/.local/bin/
print "Adding Fish CLI Aliases"
alias ls "exa"
funcsave ls
alias lsl "exa -la"
funcsave lsl
print "Installing Fisher"
curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
print "Installing Fisher: Spacefish Theme"
fisher install matchai/spacefish
print "Installing Fisher: Dracula Plugin"
fisher install dracula/fish
print "Installing Fisher: FZF Plugin"
fisher install PatrickF1/fzf.fish
print "Installing Fisher: NVM & Bass plugins"
fisher install FabioAntunes/fish-nvm edc/bass
print "Writing Fish Config"
mkdir -p ~/.config/fish/
cat <<EOF > ~/.config/fish/config.fish
if status is-interactive
and not set -q TMUX
cd ~
tmux new-session -A -s main -c '~'
end
set SPACEFISH_PROMPT_ADD_NEWLINE false
set SPACEFISH_PROMPT_SEPARATE_LINE true
EOF
print "Setting Fish to default shell"
chsh -s /usr/bin/fish
print "Run fish then ctrl+b, followed by I to pull down plugins"
print "Let's do this! ๐Ÿš€"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment