Ubuntu tips & tweaks

fish + agnoster theme
# install fish and fonts
sudo apt install fish fonts-powerline

# install oh-my-fish
curl -L https://get.oh-my.fish | fish

# configure and install theme
fish
set --erase fish_greeting
omf install agnoster

# set as default shell
sudo chsh -s /usr/bin/fish
chsh -s /usr/bin/fish

Disable Meltdown and Spectre v2 and v4 security patches (+30% performance)
# add to /etc/default/grub options: nopti nospectre_v2 nospec_store_bypass_disable
# GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nopti nospectre_v2 nospec_store_bypass_disable"
sudo vi /etc/default/grub

# update grub
sudo update-grub

# or for grub2
grub2-mkconfig -o /boot/grub2/grub.cfg

# reboot to apply
reboot

# check status
grep . /sys/devices/system/cpu/vulnerabilities/*

Windows - Ubuntu dual boot without grub
# /dev/sda1 - Windows boot partition
# /dev/sda2 - Windows C: partition
# /dev/sda3 - Ubuntu with grub installed to /dev/sda3

# save boot sector
# and copy it to c:\linux.bin
dd if=/dev/sda3 of=linux.bin bs=512 count=1

# windows loader
bcdedit /create /d "Linux" /application BOOTSECTOR
# copy {ID}
bcdedit /set {ID} device partition=c:
bcdedit /set {ID}  path \linux.bin
bcdedit /displayorder {ID} /addlast
bcdedit /timeout 15

Chromium
sudo add-apt-repository ppa:canonical-chromium-builds/stage
sudo apt-get update
sudo apt-get install chromium-browser chromium-browser-l10n chromium-codecs-ffmpeg-extra
Vim 8.0
sudo add-apt-repository ppa:jonathonf/vim
sudo apt update
sudo apt install vim
NVidia latest drivers ppa
sudo add-apt-repository ppa:graphics-drivers/ppa
Misc
# remove useless apps
sudo apt-get remove zeitgeist* -y
sudo apt-get remove evolution-data-server
sudo apt-get autoremove

sudo systemctl disable timidity
sudo systemctl mask timidity
sudo systemctl disable avahi-daemon
sudo systemctl mask avahi-daemon

# turning off Apport:
sudo sed -i 's/enabled=1/enabled=0/g' /etc/default/apport

# turning off guest session
sudo sh -c 'printf "[SeatDefaults]\nallow-guest=false\n" >/usr/share/lightdm/lightdm.conf.d/50-no-guest.conf'

# .icm color profile manager
sudo apt install gnome-color-manager

# classic menu
sudo apt install classicmenu-indicator


Fingerprint unlock
add-apt-repository ppa:fingerprint/fingerprint-gui
apt update
apt install libbsapi policykit-1-fingerprint-gui fingerprint-gui
reboot
Sublime Text disable Antialiasing
cat /etc/fonts/conf.d/41-sublime-text.conf
    <?xml version="1.0"?>
    <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    <fontconfig>
		<match target="pattern">
		<test name="prgname">
		    <string>sublime_text</string>
		</test>
		<edit name="antialias" mode="assign"><bool>false</bool></edit>
		<edit name="rgba" mode="append"><const>rgb</const></edit>
		<edit name="hinting" mode="append"><bool>true</bool></edit>
        </match>
    </fontconfig>


# Add to sublime prefs:
#    "font_options": ["no_antialias"],
# should be something like this:
{
    "bold_folder_labels": true,
    "color_scheme": "Packages/User/SublimeLinter/OneDark (SL).tmTheme",
    "fallback_encoding": "Cyrillic (Windows 1251)",
    "font_face": "ubuntu mono",
    "font_size": 11,
    "font_options": ["no_antialias"],
    "highlight_modified_tabs": true,
    "ignored_packages":
    [
	"Package Control",
	"Vintage"
    ],
    "theme": "OneDarkMaterial.sublime-theme",
    "trim_trailing_white_space_on_save": true,
    "update_check": false
}

Remmina 1.2.x
sudo apt-add-repository ppa:remmina-ppa-team/remmina-next
sudo apt-get update
sudo apt-get install remmina remmina-plugin-rdp libfreerdp-plugins-standard
Thunar as default filemanager
sudo apt-get install thunar -y
gvfs-mime --set inode/directory Thunar.desktop
# and check here:
exo-preferred-applications
Flatabulous theme
# https://github.com/anmoljagetia/Flatabulous

# theme
sudo apt-get install unity-tweak-tool
sudo add-apt-repository ppa:noobslab/themes
sudo apt-get update
sudo apt-get install flatabulous-theme arc-flatabulous-theme 

# icons
sudo add-apt-repository ppa:noobslab/icons
sudo apt-get update
sudo apt-get install ultra-flat-icons

Unity animation speed
sudo apt-get install dconf-tools
dconf write /com/canonical/unity/minimize-speed-threshold 3
Latest Libreoffice
sudo add-apt-repository ppa:libreoffice/ppa
sudo add-apt-repository ppa:libreoffice/libreoffice-5-3
sudo apt-get update
sudo apt-get dist-upgrade
VMware Horizon View 3.5.0 Client in Ubuntu
sudo bash
wget https://download3.vmware.com/software/view/viewclients/CART15Q3/VMware-Horizon-Client-3.5.0-2999900.x64.bundle
env TERM=dumb VMWARE_EULAS_AGREED=yes VMWARE_KEEP_CONFIG=yes
sh ./VMware-Horizon-Client-3.5.0-2999900.x64.bundle --console --required

# create file /usr/share/applications/vmware-horizon-client.desktop
[Desktop Entry]
Name=VMware Horizon Client
Comment=Connect to VMware Horizon View virtual machines
GenericName=VMware Horizon Client
Exec=vmware-view
Icon=/usr/share/pixmap/vmware-view.png
Terminal=false
StartupNotify=true
Type=Application
Categories=Network
HP printers
aptitude install hplip-gui
hp-setup
iptables-persistent
apt install iptables-persistent ipset -y
ipset -N blacklist
ipset -A blacklist 1.2.3.4

cat /etc/iptables/rules.v4

*filter
:INPUT ACCEPT [0:0]
# -A INPUT -m set --match-set blacklist src -j DROP
# -A INPUT -m set --match-set blacklist dst -j DROP
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
# -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -j DROP
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [18:1305]
COMMIT
Remove antialiasing + ms fonts
apt install unity-tweak-tool ttf-mscorefonts-installer
# in unity-tweak-tool font control panel switch off antialiasing and turn hinting to full
# then remove antialiasing for all apps:
sudo rm /etc/fonts/conf.d/10-*
reboot
Remove tearing with Nvidia cards
# try the best for you:
nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceCompositionPipeline = On }"
nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"

# For Ubuntu goto Nvidia X Server Settings -> X Server Display Configuration -> Save to X Configuration File

# the better one add here
cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bkp
vi /etc/X11/xorg.conf

 Section "Screen"
    Identifier     "Screen1"
    Device         "Device1"
    Monitor        "Monitor1"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option "metamodes" "nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"
    # Option "metamodes" "VGA-0: 1152x864_60 +0+0, DVI-D-0: 1680x1050_60 +0+864 { ForceCompositionPipeline = On }"
    SubSection     "Display"
        Depth       24
    EndSubSection
 EndSection

Powersave on notebooks
sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get install tlp tlp-rdw acpi-call-tools
sudo tlp start
Backlight on notebooks
sudo mcedit /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"
sudo update-grub

** Backlight applet
sudo add-apt-repository ppa:indicator-brightness/ppa
sudo apt-get update
sudo apt-get install indicator-brightness