Last active
July 22, 2020 12:14
-
-
Save Neonox31/e08be88866d4ae4b024b6e36818a90d0 to your computer and use it in GitHub Desktop.
Machine fresh install
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 | |
get_latest_gh_release() { | |
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | |
grep '"tag_name":' | # Get tag line | |
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value | |
} | |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
sudo sh -c 'echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list' | |
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 | |
sudo apt-add-repository ppa:fish-shell/release-3 | |
sudo add-apt-repository ppa:photoflare/photoflare-stable | |
sudo apt update | |
sudo apt install -y gnome-tweak-tool \ | |
gnome-shell-extensions \ | |
chrome-gnome-shell \ | |
curl \ | |
vim \ | |
xclip \ | |
git \ | |
htop \ | |
fish \ | |
tilix \ | |
google-chrome-stable \ | |
yarn \ | |
direnv \ | |
fritzing \ | |
fritzing-parts \ | |
photoflare | |
sudo snap install --classic sublime-text | |
sudo snap install --classic gimp | |
# Necessary for printer detecting inside gimp | |
sudo snap refresh gimp --edge | |
sudo snap connect gimp:cups-control | |
sudo snap install yakyak \ | |
vlc \ | |
gimp \ | |
http \ | |
jq \ | |
yq \ | |
rsync-leftyfb | |
# Install brew | |
curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh | bash | |
# Install brew dependencies | |
brew install derailed/k9s/k9s ghq zaquestion/tap/lab stern hub autojump | |
# Setup mounts | |
echo "//192.168.10.252/photo /media/nas/photos cifs credentials=/root/.smbcredentials,iocharset=utf8,gid=0,uid=0,_netdev,auto,vers=1.0 0 0" | sudo tee -a /etc/fstab | |
echo "//192.168.10.252/docs /media/nas/docs cifs credentials=/root/.smbcredentials,iocharset=utf8,gid=0,uid=0,_netdev,auto,vers=1.0 0 0" | sudo tee -a /etc/fstab | |
echo "//192.168.10.252/downloads /media/nas/downloads cifs credentials=/root/.smbcredentials,iocharset=utf8,gid=0,uid=0,_netdev,auto,vers=1.0 0 0" | sudo tee -a /etc/fstab | |
echo "//192.168.10.252/video /media/nas/videos cifs credentials=/root/.smbcredentials,iocharset=utf8,gid=0,uid=0,_netdev,auto,vers=1.0 0 0" | sudo tee -a /etc/fstab | |
# Setup fish | |
chsh -s `which fish` | |
# Setup tilix | |
gsettings set org.gnome.desktop.default-applications.terminal exec tilix | |
# Install fish extensions | |
curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish | |
fish -c 'fisher add jorgebucaran/fish-nvm' | |
# Init dev env | |
mkdir -p ~/code | |
# Restore dotfiles | |
ghq get [email protected]:neonox31/dotfiles.git | |
## Restore for fish | |
cp ~/code/gitlab.com/neonox31/dotfiles/.config/fish/config.fish ~/.config/fish/config.fish | |
cp ~/code/gitlab.com/neonox31/dotfiles/.config/fish/functions/* ~/.config/fish/functions/ | |
cp ~/code/gitlab.com/neonox31/dotfiles/.config/fish/completions/* ~/.config/fish/completions/ | |
cp ~/code/gitlab.com/neonox31/dotfiles/.config/fish/conf.d/* ~/.config/fish/conf.d/ | |
## Restore for git | |
cp ~/code/gitlab.com/neonox31/dotfiles/.gitconfig ~/.gitconfig | |
cp ~/code/gitlab.com/neonox31/dotfiles/.gitconfig-webfactory ~/.gitconfig-webfactory | |
cp ~/code/gitlab.com/neonox31/dotfiles/.gitignore-global ~/.gitignore-global | |
## Restore for tilix | |
dconf load /com/gexperts/Tilix/ < ~/code/gitlab.com/neonox31/dotfiles/dconf/tilix.dconf | |
## Restore for GNOME extensions | |
cp -R ~/code/gitlab.com/neonox31/dotfiles/.local/share/gnome-shell/extensions/* ~/.local/share/gnome-shell/extensions/ | |
ls ~/.local/share/gnome-shell/extensions | xargs -L1 gnome-shell-extension-tool -e | |
# Install KeeWeb (https://keeweb.info) | |
VERSION=$(get_latest_gh_release "keeweb/keeweb") | |
URL="https://github.com/keeweb/keeweb/releases/download/$VERSION/KeeWeb-$(echo $VERSION | cut -c2-).linux.x64.deb" | |
wget -P /tmp $URL | |
sudo dpkg -i /tmp/$(basename -- "$URL") | |
# Install Keybase (https://keybase.io) | |
wget -P /tmp https://prerelease.keybase.io/keybase_amd64.deb | |
sudo dpkg -i /tmp/keybase_amd64.deb | |
sudo apt install -f | |
sed -i '$ s/^/#/' ~/.config/autostart/keybase_autostart.desktop # Disable autostart | |
run_keybase | |
# Setup keybase | |
keybase pgp export | gpg --import | |
keybase pgp export -s | gpg --alow-secret-key-import --import - | |
gpg --list-key | |
gpg --list-secret-keys --keyid-format LONG | |
# Install Jetbrains toolbox (https://www.jetbrains.com/toolbox/) | |
wget -P /tmp https://raw.githubusercontent.com/nagygergo/jetbrains-toolbox-install/master/jetbrains-toolbox.sh | |
sudo chmod +x /tmp/jetbrains-toolbox.sh | |
/tmp/jetbrains-toolbox.sh | |
# Install Plex media player (https://knapsu.eu/plex/) | |
URL="https://knapsu.eu$(curl -Ss https://knapsu.eu/plex/ | grep -Po '\/data\/plex\/Plex_Media_Player_.*?(_)x64.AppImage' | head -n 1)" | |
wget -P /tmp $URL | |
sudo chmod +x /tmp/$(basename -- "$URL") | |
/tmp/$(basename -- "$URL") | |
# Install station (https://getstation.com) | |
wget -P /tmp -O station.AppImage https://dl.getstation.com/download/linux_64?filetype=AppImage | |
sudo chmod +x /tmp/station.AppImage | |
/tmp/station.AppImage | |
# Shrink the disk buffers to a more reasonable size. This is a known bug on 64 bits machines. | |
sudo bash -c 'cat > /etc/sysctl.d/becko-vm-dirty.conf <<EOF | |
vm.dirty_background_bytes = 16777216 | |
vm.dirty_bytes = 50331648 | |
EOF' | |
# Display black & white emojis for IDEA | |
sudo apt install fonts-symbola | |
fc-cache -f -v | |
## Don't forget to set `Symbola` as fallback font | |
# Reinstall default colored emojis | |
sudo apt install fonts-noto-color-emoji | |
fc-cache -f -v | |
# Auto switch wifi based on ethernet plug | |
sudo bash -c 'cat > /etc/NetworkManager/dispatcher.d/99-wlan << EOF | |
#!/bin/bash | |
wired_interfaces="en.*|eth.*" | |
if [[ "$1" =~ $wired_interfaces ]]; then | |
case "$2" in | |
up) | |
nmcli radio wifi off | |
;; | |
down) | |
nmcli radio wifi on | |
;; | |
esac | |
fi | |
' | |
sudo chmod +x /etc/NetworkManager/dispatcher.d/99-wlan |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment