Skip to content

Instantly share code, notes, and snippets.

@saurabheights
Last active September 17, 2024 14:36
Show Gist options
  • Save saurabheights/7685094ed2daf00406068b76f03982be to your computer and use it in GitHub Desktop.
Save saurabheights/7685094ed2daf00406068b76f03982be to your computer and use it in GitHub Desktop.
A gist to quickly setup ubuntu for your needs.
# Disable need to provide password for sudo. use only if you can lock system when afk.
sudo visudo
# Add below line to the end of file, where replace $USER with your system username.
$USER ALL=(ALL) NOPASSWD: ALL
# Install fzf for better reverse search
sudo apt install fzf
cat /usr/share/doc/fzf/README.Debian # For how to integrate with your shell
echo "source /usr/share/doc/fzf/examples/completion.bash" » ~/.bashrc
# Configure script variables
[email protected]
GIT_USERNAME=saurabheights
# Update to nvidia-418 or above
sudo ubuntu-drivers autoinstall
sudo reboot
# Firefox play mp4
# Tabbed PDF Viewer with Restore session that works unlike Foxit
# Decent light weight image cropper.
# Install sticky notes for ubuntu
# Upgrade vim/vi - must.
sudo apt install -y htop tree cmake-qt-gui ubuntu-restricted-extras qpdfview gthumb xpad
sudo apt upgrade -y vim
# Set locale for git
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
sudo locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales
# Disable opening nautilus on connecting mobile for charging
sudo gsettings set org.gnome.desktop.media-handling automount-open false
# Setup Mega - Cloud Drive offering 50 GB storage for free
# https://mega.nz/linux/MEGAsync/xUbuntu_16.04/amd64/megasync-xUbuntu_16.04_amd64.deb
# sudo dpkg -i megasync-xUbuntu_16.04_amd64.deb
#Probably dependency wont meet, so run below command
# sudo apt-get -f install
# sudo dpkg -i megasync-xUbuntu_16.04_amd64.deb
# rm megasync-xUbuntu_16.04_amd64.deb
# Set up Spotify
snap install spotify
# Set up Sublime
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt-get update
sudo apt-get install -y sublime-text
# Set up Xclip to cut copy from pipe(bash)
sudo apt install -y xclip
# Set up ntfs-3g
sudo apt install -y ntfs-3g
# Install clipboard manager
# sudo apt-get install -y clipit # Broken - https://github.com/CristianHenzel/ClipIt/issues/97
sudo add-apt-repository ppa:afelinczak/ppa
sudo apt-get update
sudo apt-get install -y clipit
# Need to be run once
clipit
# Install youtube-dl - ofcourse to download youtube videos
sudo apt-get remove -y youtube-dl
sudo wget https://yt-dl.org/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+x /usr/local/bin/youtube-dl
# Install Zotero - Research Papers - Reference management software
#Below commented commands wont allow automatic updates.
#wget https://raw.github.com/smathot/zotero_installer/master/zotero_installer.sh -O /tmp/zotero_installer.sh
#chmod +x /tmp/zotero_installer.sh
#sudo /tmp/zotero_installer.sh
sudo apt-add-repository ppa:smathot/cogscinl
sudo apt-get update
sudo apt-get install -y zotero-standalone
sudo chown sk:sk /opt/zotero/ # To allow updates from gui itself. Use https://app.koofr.net/dav/Koofr for webdav
# Install Chrome - Needs work, chrome doesn't sync
# Dont AUTOMATE. Chrome from this repo often doesnt stores passwords in passwords.google.com, buggy.
# wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
# sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
# sudo apt-get update
# sudo apt-get install -y google-chrome-stable
# Install Git and Git Gui
sudo apt-get install -y git git-gui
git config --global core.editor "subl -n -w"
git config --global user.email ${GIT_EMAIL_ID}
git config --global user.name ${GIT_USERNAME}
# Always output gitdiff to stdout. Allows you to find intermediate changes you did if you forget to commit.
git config --global core.pager cat
# Disable git gui warning to compress the loose objects
git config --global gui.gcwarning false
# Install Powertop - Makes Battery last longer - Needs more work.
sudo apt install -y powertop
echo "@Saurabh - Wait for powertop to calibrate itself. Will take 15-30 minutes."
sudo powertop -c
# Install sshpass for nopassword sync
sudo apt-get install -y sshpass
# Install sox to play sound on ubuntu
sudo apt install -y sox
# Install vlc
sudo apt update
sudo apt install -y vlc
# Install to convert pynb to pdf and all latex packages
sudo apt-get install -y texlive texlive-latex-extra pandoc texlive-xetex texlive-full
# Install Gummi for realtime view of latex
sudo apt install -y gummi
sudo apt install -y gnome-tweak-tool # For nightly and other things
echo "########################################"
echo "INSTALL KILE FROM UBUNTU SOFTWARE CENTER"
echo "########################################"
sudo apt install okular
# Integrate git completion script and git prompt script
# The below untested line should be enough
#sudo apt-get install git-core bash-completion
wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -O ~/.git-completion.bash
wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -O ~/.git-prompt.sh
echo "source ~/.git-completion.bash" >> ~/.bashrc
# ToDo-Git prompt needs more work. Last 3 directory of folder path, current git branch name, and if anything has changed.
echo "source ~/.git-prompt.sh" >> ~/.bashrc
# Add open with option in context menu
sudo apt-get install -y nemo
# Install tmux - better for creating terminalless-ssh session. Only for servers.
sudo apt install -y tmux
# Set number of workspaces - 2 rows x 4 columns
dconf write /org/compiz/profiles/unity/plugins/core/vsize 2
dconf write /org/compiz/profiles/unity/plugins/core/hsize 4
# Install below gnome extension to limit alt+tab using windows
# https://extensions.gnome.org/extension/3148/alt-tab-for-dual-monitor/
gsettings set org.gnome.shell.app-switcher current-workspace-only true
# Use dark theme for nautilus
gsettings set org.gnome.desktop.interface color-scheme prefer-dark
# See available themes by deleting Yaru-dark and pressing tab
# gsettings set org.gnome.desktop.interface gtk-theme Yaru-dark
# Remove title bar from firefox and use tree-style plugin
echo "UNTESTED CODE-CREATING CUSTOM CSS FILE FOR FIREFOX"
mkdir ~/.mozilla/firefox/*.default/chrome/
cd ~/.mozilla/firefox/*.default/chrome/
echo '@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");' >> ~/.mozilla/firefox/*.default/chrome/userChrome.css
echo '#TabsToolbar { visibility: collapse !important;}' >> ~/.mozilla/firefox/*.default/chrome/userChrome.css
echo "RESTART FIREFOX TO SEE IF TITLEBAR IS REMOVED"
#Install SpotifyRise and AlarmClock - Make alarms that play song from spotify
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886
sudo apt-get update
sudo apt-get install -y alarm-clock-applet wmctrl xautomation
sudo apt-get -f install
wget -O spotify-rise https://raw.githubusercontent.com/gcushen/spotify-rise/master/spotify-rise
sudo install spotify-rise /usr/local/bin/spotify-rise
sudo apt install alarm-clock-applet
sudo apt-get install -y xautomation
spotify-rise ${SPOTIFY_PLAYLIST_URI}
echo 'Create an ALARM WITH THIS SPOTIFY URI:- spotify-rise spotify:user:1164323909:playlist:6L5fWP3stIdYISaca0ZyAs'
# Install openjdk1.7
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install -y openjdk-7-jdk
# Install pdfshuffler, a simple tool to combine pdfs, remove slides, etc.
# Useful for students: make single pdf of all slides.
sudo apt-get update
sudo apt-get install -y pdfshuffler
#Install Telegram - Better than whatsapp
sudo snap install telegram-desktop
# Install to monitor GPU usage as graph
echo "deb https://apt.izzysoft.de/ubuntu generic universe" | sudo tee -a /etc/apt/sources.list
wget http://apt.izzysoft.de/izzysoft.asc
sudo apt-key add izzysoft.asc
sudo apt-get update
sudo apt-get install -y monitorix
sudo subl /etc/monitorix/monitorix.conf
# Edit graph_enable for nvidia, search '<graph_enable>'
sudo service monitorix restart
# Press Space after selecting any file to get quick peek, like mac
sudo apt-get -y install gnome-sushi
# Install kdocker, used to minimize any app to Tray bar
sudo apt-get -y install kdocker
@saurabheights
Copy link
Author

This automated script installs must needed things for me. Any inputs are welcome.

@saurabheights
Copy link
Author

saurabheights commented Feb 28, 2018

Nvidia and CUDA:

  1. Go to Software and Updates -> Drivers -> Install Nvidia drivers.
  2. Go to https://developer.nvidia.com/cuda-90-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=deblocal and download cuda-9.0.deb file for nvidia driver version 184.111.
  3. Run
    sudo dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb
    sudo apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub
    sudo apt-get update
    sudo apt-get install cuda
  4. In ~/.bashrc, add
    export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
    export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

@saurabheights
Copy link
Author

If Bluetooth doesn't start try this:-

  1. sudo apt-get install linux-generic-hwe-16.04-edge xserver-xorg-input-libinput-hwe-16.04
    or
  2. Change #AutoEnable=false to AutoEnable=true in the /etc/bluetooth/main.conf . https://vilimpoc.org/blog/2016/04/30/ubuntu-16-04-bluetooth-speakers/

@saurabheights
Copy link
Author

Image Utilities

sudo apt install libimage-exiftool-perl
sudo apt install gdal-bin

@saurabheights
Copy link
Author

saurabheights commented May 4, 2019

For hibernate, Get UUID of swap partition from disks utility:-
sudo nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=<UUID of swap disk>"
sudo update-grub
sudo systemctl hibernate

Add Hibernate Button using:-

sudo apt-get install chrome-gnome-shell
Install hibernate Status button from https://extensions.gnome.org/extension/755/hibernate-status-button/

@saurabheights
Copy link
Author

@saurabheights
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment