Skip to content

Instantly share code, notes, and snippets.

@alextakitani
Last active March 15, 2024 15:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save alextakitani/4698416 to your computer and use it in GitHub Desktop.
Save alextakitani/4698416 to your computer and use it in GitHub Desktop.
Montagem de ambiente dev linux #linux
#atualizado para Tuxedo OS 2 ( Ubuntu 22.04 )
# como usar:
# Clique ali em cima no botão raw
# salve o arquivo no seu disco.
# abra o terminal na pasta onde vc baixou o arquivo.
# de permissão de execução chmod +x post_install.sh
# rode:
# ./post_install.sh
# coloque sua senha
# ao final pedirá novamente a senha para mudar o shell pra zsh.
sudo apt update && sudo apt upgrade -y
sudo apt install -y zsh ssh curl nfs-common zenity gnome-keyring git cmake g++ build-essential vim libcurl4-openssl-dev htop iotop libmagickwand-dev imagemagick fonts-firacode imwheel tmux autokey-qt rustc libyaml-dev gawk translate-shell zsh-antigen
sudo locale-gen pt_BR.UTF-8
# cedilha no teclado en-us internacional
wget https://raw.githubusercontent.com/silveira/cedilha.sh/master/cedilha.sh
sudo bash cedilha.sh
rm cedilha.sh
test -f $HOME/.XCompose1 || touch $HOME/.XCompose1
bash -c 'cat << EOF > $HOME/.XCompose1
include "%L"
<dead_acute> <c> : "ç" ccedilla
<dead_acute> <Ç> : "Ç" ccedilla
EOF'
# Create the file repository configuration:
sudo sh -c 'echo "deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# Update the package lists:
sudo apt-get update
sudo apt-get install -y postgresql-16 postgresql-contrib libpq-dev
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'postgres';"
sudo apt-get install redis-server memcached -y
# curl -L http://install.ohmyz.sh | sh
#plugins zsh
# sed -i.bak 's/git/git command-not-found bundler z zsh-autosuggestions zsh-syntax-highlighting asdf/g' ~/.zshrc
test -f $HOME/.zshrc || touch $HOME/.zshrc
curl -L git.io/antigen > $HOME/antigen.zsh
cat << EOF >> ~/.zshrc
source $HOME/antigen.zsh
# Load the oh-my-zsh's library
antigen use oh-my-zsh
antigen bundle git
# Syntax highlighting bundle.
antigen bundle zsh-users/zsh-syntax-highlighting
# Fish-like auto suggestions
antigen bundle zsh-users/zsh-autosuggestions
# Extra zsh completions
antigen bundle zsh-users/zsh-completions
antigen bundle command-not-found
antigen bundle bundler
antigen bundle z
antigen bundle asdf
# Load the theme
antigen theme robbyrussell
# Tell antigen that you're done
antigen apply
alias dm='bundle exec rake db:migrate'
alias dmt='bundle exec rake db:migrate && rake db:test:prepare'
alias dmp='RAILS_ENV=production bundle exec rake db:migrate'
alias rc='bundle exec rails c'
alias rg='bundle exec rails g'
alias rcp='RAILS_ENV=production bundle exec rails c'
alias rs='bundle exec rails s'
alias rsp='RAILS_ENV=production bundle exec rails s'
alias pywww='python -m SimpleHTTPServer'
alias os='overmind s'
alias oc='overmind connect web'
EOF
# VsCode
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt update && sudo apt install code -y
# Vscode Better erros
# no seu app rails, instale a gem better_errors: https://github.com/charliesome/better_errors
# ainda no seu app crie o arquivo initializers/better_errors.rb
# coloque a linha
# BetterErrors.editor = "code://open?url=file://%{file}&line=%{line}"
# agora, quando der erro, vc pode clicar no link e o vscode abrirá no arquivo e linha corretos
sudo bash -c 'cat << EOF > /usr/share/applications/vscode-urihandler.desktop
[Desktop Entry]
Name=VSCode
Comment=Open code:// links in Atom editor
GenericName=URI handler
Exec=/usr/bin/code-urihandler %U
Icon=code
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Utility;TextEditor;Development;
MimeType=x-scheme-handler/code
EOF'
sudo bash -c 'cat << EOF > /usr/bin/code-urihandler
#!/bin/bash
request=\${1:23}
request=\${request//%2F//}
request=\${request/&line=/:}
code -g "\$request"
EOF'
sudo chmod +x /usr/bin/code-urihandler
sudo update-desktop-database
sudo bash -c 'cat << EOF > /etc/sysctl.conf
fs.inotify.max_user_watches=524288
fs.inotify.max_user_instances = 256
EOF'
#ASDF
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
touch $HOME/.tool-versions
bash -c 'cat << EOF > $HOME/.default-gems
bundler
mailcatcher
htmlbeautifier
rubocop
fasterer
rubocop-performance
rubocop-rspec
rubocop-rails
solargraph
EOF'
echo 'gem: --no-document' > ~/.gemrc
sudo chsh -s /bin/zsh
# source ~/.zshrc
# suggestions
# git clone https://github.com/zsh-users/zsh-autosuggestions.git ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
# highlighting
# git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
#yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
flatpak install flathub io.missioncenter.MissionCenter com.google.Chrome com.discordapp.Discord com.microsoft.Edge io.dbeaver.DBeaverCommunity org.gnome.meld org.gnome.Calculator com.github.liferooter.textpieces com.github.tchx84.Flatseal com.bitwarden.desktop com.rtosta.zapzap com.dropbox.Client org.gimp.GIMP org.kde.kolourpaint net.cozic.joplin_desktop com.github.dynobo.normcap io.crow_translate.CrowTranslate org.chromium.Chromium io.github.thetumultuousunicornofdarkness.cpu-x com.github.hluk.copyq -y
# Instala os plugins, ruby e node
echo 'legacy_version_file = yes' > $HOME/.asdfrc
zsh -c 'source ~/.zshrc; asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git'
zsh -c 'source ~/.zshrc; asdf install nodejs 14.21.1'
zsh -c 'source ~/.zshrc; asdf global nodejs 14.21.1'
zsh -c 'source ~/.zshrc; asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git'
zsh -c 'source ~/.zshrc; asdf install ruby 2.7.6'
zsh -c 'source ~/.zshrc; RUBY_CONFIGURE_OPTS=--enable-yjit asdf install ruby 3.3.0'
zsh -c 'source ~/.zshrc; asdf global ruby 3.3.0'
#Overmind
OVERMIND_LAST_VERSION=`curl -s https://api.github.com/repos/DarthSim/overmind/releases/latest | jq '.assets[] | select(.name|match("linux-amd64.gz$")) | .name' | tr -d '"'`
OVERMIND_LAST_VERSION_FILE=`echo $OVERMIND_LAST_VERSION | rev | cut -f 2- -d '.' | rev`
curl -s https://api.github.com/repos/DarthSim/overmind/releases/latest | jq '.assets[] | select(.name|match("linux-amd64.gz$")) | .browser_download_url' | xargs -n 1 wget
gunzip $OVERMIND_LAST_VERSION
sudo mv $OVERMIND_LAST_VERSION_FILE /usr/local/bin/overmind
chmod +x /usr/local/bin/overmind
# makes Krunner open with the Meta Key
kwriteconfig5 --file ~/.config/kwinrc --group ModifierOnlyShortcuts --key Meta "org.kde.kglobalaccel,/component/org_kde_krunner_desktop,,invokeShortcut,_launch" && qdbus org.kde.KWin /KWin reconfigure
echo "Acabou! De um boot ou logout - Crie um profile no Konsole pra usar o zsh".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment