Skip to content

Instantly share code, notes, and snippets.

@hiono
Last active February 8, 2022 03:35
Show Gist options
  • Save hiono/9c1e602d5307d0dc1415007866eb64a0 to your computer and use it in GitHub Desktop.
Save hiono/9c1e602d5307d0dc1415007866eb64a0 to your computer and use it in GitHub Desktop.
#!/bin/bash
# usage
# curl -s https://gist.githubusercontent.com/hiono/9c1e602d5307d0dc1415007866eb64a0/raw | bash
set -e
set -v
sudo apt -qq update
# addtopath
curl -s https://gist.githubusercontent.com/ccoomber/5886028/raw >> ~/.bashrc
echo >> ~/.bashrc
# my local bin
mkdir -p ~/.local/bin
echo 'addToPATH ~/.local/bin' >> ~/.bashrc
export PATH="~/.local/bin:$PATH"
# direnv
sudo apt install -y -q curl jq grep
sudo curl -Lo /usr/local/bin/direnv $(curl -sL https://api.github.com/repos/direnv/direnv/releases/latest | jq -r '.assets[].browser_download_url'| grep 'linux-amd64')
sudo chmod 755 /usr/local/bin/direnv
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc
eval "$(direnv hook bash)"
## add layout_poetry
mkdir -p ~/.config/direnv
curl -o ~/.config/direnv/direnvrc https://gist.githubusercontent.com/hiono/e073049133a5d56bee3c9f7f20ca5179/raw
# anyenv
sudo apt-get install -y -q make git build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils
export PATH="~/.anyenv/bin:$PATH"
if [ -d ~/.anyenv ];then
pushd ~/.anyenv
git pull --all
popd
else
git clone https://github.com/anyenv/anyenv ~/.anyenv
echo 'addToPATH ~/.anyenv/bin' >> ~/.bashrc
anyenv init
mkdir -p $(anyenv root)/plugins
fi
eval "$(anyenv init -)"
[ ! -e ~/.config/anyenv/anyenv-install ] && anyenv install --force-init
[ ! -d $(anyenv root)/plugins/anyenv-update ] && git clone https://github.com/znz/anyenv-update.git $(anyenv root)/plugins/anyenv-update
# emacs
sudo apt install -y -q emacs-nox git git-flow git-lfs
[ -d ~/.emacs.d.old ] && rm -rf ~/.emacs.d.old
[ -d ~/.emacs.d ] && mv -f ~/.emacs.d ~/.emacs.d.old
[ ! -d ~/.emacs.d/.git ] && git clone https://github.com/hiono/.emacs.d.git ~/.emacs.d
# pyenv & poetry
sudo apt install -y -q libffi-dev
PYVER=3.9.9
if [ ! -e ~/.anyenv/envs/pyenv ];then
anyenv install pyenv
eval "$(anyenv init -)"
pyenv install ${PYVER}
pyenv global ${PYVER}
fi
if [ ! -e ~/.local/bin/poetry ];then
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -
poetry config virtualenvs.in-project true
fi
unset PYVER
# ca-certificates
sudo apt-get install --reinstall ca-certificates
for SERVER in gitlab.com:443 github.com:443 # AND ADD PRIVATE REPOSITRY
do
echo -n | openssl s_client -showcerts -connect ${SERVER} 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment