Skip to content

Instantly share code, notes, and snippets.

@Alyetama
Last active January 2, 2022 18:59
Show Gist options
  • Save Alyetama/12d28b6d37cb2216bc56c5867fe8044a to your computer and use it in GitHub Desktop.
Save Alyetama/12d28b6d37cb2216bc56c5867fe8044a to your computer and use it in GitHub Desktop.
#!/bin/bash
printf "Github email? "
read -r github_email
printf "Github username? "
read -r github_username
#-----------------------------------------------------------------------------
sudo apt update
#-----------------------------------------------------------------------------
curl https://getcroc.schollz.com | bash
sudo apt install zsh ripgrep fd-find make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils \
tk-dev libffi-dev liblzma-dev python-openssl git -y
sudo ln -s $(which fdfind) /usr/bin/fd
echo ">>>> Finished installing some dependencies <<<<"
sleep 2
#-----------------------------------------------------------------------------
curl -fsSL https://get.docker.com -o get-docker.sh
sh ./get-docker.sh
sudo curl -L "https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-linux-x86_64" \
-o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
rm get-docker.sh
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
mkdir /home/"$USER"/.docker
sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R
echo ">>>> Finished installing Docker <<<<"
sleep 2
#-----------------------------------------------------------------------------
# sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
# curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | \
# sudo tee /etc/apt/trusted.gpg.d/caddy-stable.asc
# curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | \
# sudo tee /etc/apt/sources.list.d/caddy-stable.list
# sudo apt update
# sudo apt install caddy -y
# echo ">>>> Finished installing Caddy <<<<"
# sleep 2
#-----------------------------------------------------------------------------
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
# echo 'export PATH=~/.cargo/bin:$PATH' >> ~/.zshrc
echo ">>>> Finished installing Rust <<<<"
sleep 2
#-----------------------------------------------------------------------------
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/agkozak/zsh-z ~/.oh-my-zsh/custom/plugins/zsh-z
echo "source ~/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc
echo "plugins=(zsh-z git)" >> ~/.zshrc
echo "source ~/.oh-my-zsh/oh-my-zsh.sh" >> ~/.zshrc
echo "alias python=python3" >> ~/.zshrc
echo "export PATH='/home/ubuntu/.local/bin:$PATH'" >> ~/.zshrc
echo ">>>> Finished setting up ohmyzsh <<<<"
sleep 2
#-----------------------------------------------------------------------------
curl https://pyenv.run | bash
sed -Ei -e '/^([^#]|$)/ {a \
export PYENV_ROOT="$HOME/.pyenv"
a \
export PATH="$PYENV_ROOT/bin:$PATH"
a \
' -e ':a' -e '$!{n;ba};}' ~/.zshrc
echo 'eval "$(pyenv init --path)"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
export PYENV_VIRTUALENV_DISABLE_PROMPT=1 >> ~/.zshrc
sudo ln -s $HOME/.pyenv/bin/pyenv /usr/bin
pyenv update
pyenv install 3.10.0
pyenv virtualenv 3.10.0 py3.10
pyenv activate py3.10
echo ">>>> Finished installing Pyenv <<<<"
sleep 2
#-----------------------------------------------------------------------------
if cat /etc/os-release | grep -q 'raspbian'; then
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm
sudo cp ./cloudflared-linux-arm /usr/local/bin/cloudflared
sudo chmod +x /usr/local/bin/cloudflared
fi
if cat /etc/os-release | grep -q 'ubuntu'; then
wget "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb"
sudo apt install ./cloudflared-linux.deb
fi
cloudflared login
echo ">>>> Finished installing cloudflared <<<<"
sleep 2
#-----------------------------------------------------------------------------
git config --global user.name $github_username
git config --global user.email $github_email
git config --global core.editor nano
ssh-keygen -t ed25519 -C "$github_email"
cd ~/.ssh
key_id=$(basename $(find -type f \( -iname "id_*" ! -iname "*.pub" \)))
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/$key_id
cat ~/.ssh/$key_id.pub
cd ~
echo ">>>> Finished setting up github account <<<<"
sleep 2
#-----------------------------------------------------------------------------
echo ">>>> Last command <<<<"
chsh -s $(which zsh)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment