sudo sh -c 'cat > /etc/apt/apt.conf.d/99force-ipv4 <<EOF
Acquire::ForceIPv4 "true";
EOF'
This does not prevent Glibc from sending AAAA lookup.
sudo cp -a /etc/gai.conf /etc/gai.conf.ofc
sudo sed -E -i 's|#precedence\s+::ffff:0:0/96\s+100|precedence ::ffff:0:0/96 100|g' /etc/gai.conf
sudo sed -i 's|#scopev4|scopev4|g' /etc/gai.conf
sudo apt-get update
sudo apt-get install tlp acpi-call-dkms
No audio suspend when on battery
sudo cp -a /etc/default/tlp /etc/default/tlp.ofc
sudo sed -i -E 's/#?SOUND_POWER_SAVE_ON_BAT=1/SOUND_POWER_SAVE_ON_BAT=0/g' /etc/default/tlp
sudo sed -i -E 's/#?CPU_BOOST_ON_AC/CPU_BOOST_ON_AC=1/g' /etc/default/tlp
sudo sed -i -E 's/#?CPU_BOOST_ON_BAT/CPU_BOOST_ON_BAT=0/g' /etc/default/tlp
sudo sed -i -E 's/#?CPU_HWP_ON_AC/CPU_HWP_ON_AC=performance/g' /etc/default/tlp
Start tlp
service
sudo systemctl start tlp.service && sudo systemctl status tlp.service
sudo tlp-stat -s
sudo apt-get install beignet-opencl-icd
sudo sh -c "echo '%sudo ALL=(ALL) NOPASSWD: /bin/ls, /bin/cp, /bin/kill, /bin/cat, /bin/chmod, /bin/chown, /usr/bin/vim, /usr/bin/emacs, /usr/bin/killall, /usr/bin/find, /sbin/reboot, /sbin/shutdown, /sbin/ifconfig, /sbin/route, /sbin/udevadm, /usr/sbin/tcpdump, /usr/sbin/dmidecode, /usr/bin/tlp-stat' > /etc/sudoers.d/commands-no-password"
sudo apt-get install htop git vim dconf-editor gnome-tweak-tool jq astyle tidy silversearcher-ag smartmontools net-tools traceroute ca-certificates curl software-properties-common ruby-full
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 sublime-text
sudo add-apt-repository ppa:kelleyk/emacs
sudo apt-get install emacs26
sudo sh -c 'cat > /etc/apt/preferences <<EOF
Package: docker-ce
Pin: version 18.06.1~ce~3-0~ubuntu
Pin-Priority: 550
EOF'
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get -y install docker-ce
sudo usermod -aG docker $USER
gover='1.11.1'
curl -O https://dl.google.com/go/go${gover}.linux-amd64.tar.gz
tar xvf go${gover}.linux-amd64.tar.gz
sudo mv go /usr/local/
sudo chown -R root:root /usr/local/go
go get -u -v github.com/mdempsky/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v golang.org/x/tools/cmd/goimports
mv go/bin/* ~/bin/
rm -f go${gover}.linux-amd64.tar.gz
sudo sh -c 'cat >> /etc/sysctl.conf <<EOF
vm.swappiness=1
vm.vfs_cache_pressure=50
vm.dirty_writeback_centisecs=1500
EOF'
sudo update-alternatives --set editor /usr/bin/vim.basic
gsettings set org.gnome.settings-daemon.plugins.xsettings hinting "'medium'"
gsettings set org.gnome.desktop.interface clock-show-date true
gsettings set org.gnome.desktop.interface clock-format 12h
gsettings set org.gnome.desktop.interface show-battery-percentage true
gsettings set org.gnome.desktop.interface enable-animations false
# gsettings set org.gnome.desktop.peripherals.mouse speed -0.6
# gsettings get org.gnome.desktop.peripherals.touchpad send-events "'disabled'"
gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 24
# gsettings set org.gnome.shell.extensions.dash-to-dock dock-position "'BOTTOM'"
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 3600
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type "'suspend'"
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 600
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type "'suspend'"
# GNOME shell keybindings
gsettings set org.gnome.shell.keybindings focus-active-notification "[]"
gsettings set org.gnome.shell.keybindings toggle-application-view "['<Super>space']"
gsettings set org.gnome.shell.keybindings toggle-message-tray "[]"
gsettings set org.gnome.desktop.wm.keybindings close "['<Super>q']"
# gsettings set org.gnome.desktop.input-sources xkb-options "['caps:ctrl_modifier']"
gsettings set org.gnome.settings-daemon.peripherals.keyboard numlock-state "'off'"
gsettings set org.gnome.desktop.interface gtk-key-theme "'Emacs'"
# GNOME terminal
gsettings set org.gnome.Terminal.Legacy.Settings default-show-menubar false
gsettings set org.gnome.Terminal.Legacy.Keybindings:/org/gnome/terminal/legacy/keybindings/ close-tab "'<Super>w'"
gsettings set org.gnome.Terminal.Legacy.Keybindings:/org/gnome/terminal/legacy/keybindings/ close-window "'<Super>q'"
gsettings set org.gnome.Terminal.Legacy.Keybindings:/org/gnome/terminal/legacy/keybindings/ new-tab "'<Super>t'"
gsettings set org.gnome.Terminal.Legacy.Keybindings:/org/gnome/terminal/legacy/keybindings/ new-window "'<Super>n'"
gsettings set org.gnome.Terminal.Legacy.Keybindings:/org/gnome/terminal/legacy/keybindings/ copy "'<Super>c'"
gsettings set org.gnome.Terminal.Legacy.Keybindings:/org/gnome/terminal/legacy/keybindings/ paste "'<Super>v'"
gsettings set org.gnome.Terminal.Legacy.Keybindings:/org/gnome/terminal/legacy/keybindings/ next-tab "'<Alt>braceright'"
gsettings set org.gnome.Terminal.Legacy.Keybindings:/org/gnome/terminal/legacy/keybindings/ prev-tab "'<Alt>braceleft'"
# https://wiki.gnome.org/Apps/Terminal/FAQ
# https://gitlab.gnome.org/GNOME/gnome-terminal/blob/master/src/org.gnome.Terminal.gschema.xml
UUID=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
echo $UUID
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ login-shell true
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ cursor-blink-mode "'off'"
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ use-system-font false
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ font "'Ubuntu Mono 11'"
# gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ use-theme-colors false
# gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ foreground-color "'#D3D7CF'"
# gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ background-color "'#2E3436'"
# gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ bold-color "'#000000'"
# gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ cursor-foreground-color "'#ffffff'"
# gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ cursor-background-color "'#000000'"
# gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ highlight-foreground-color "'#ffffff'"
# gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ highlight-background-color "'#000000'"
# gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${UUID}/ palette "['#2E3436', '#CC0000', '#4E9A06', '#C4A000', '#3465A4', '#75507B', '#06989A', '#D3D7CF', '#555753', '#EF2929', '#8AE234', '#FCE94F', '#729FCF', '#AD7FA8', '#34E2E2', '#EEEEEC']"
# gsettings set org.gnome.nautilus.preferences default-folder-viewer "'list-view'"
Edit /etc/fonts/conf.avail/64-language-selector-prefer.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias>
<family>sans-serif</family>
<prefer>
<family>Noto Sans CJK SC</family>
<family>Noto Sans CJK JP</family>
<family>Noto Sans CJK KR</family>
<family>Noto Sans CJK TC</family>
</prefer>
</alias>
<alias>
<family>serif</family>
<prefer>
<family>Noto Serif CJK SC</family>
<family>Noto Serif CJK JP</family>
<family>Noto Serif CJK KR</family>
<family>Noto Serif CJK TC</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Noto Sans Mono CJK SC</family>
<family>Noto Sans Mono CJK JP</family>
<family>Noto Sans Mono CJK KR</family>
<family>Noto Sans Mono CJK TC</family>
</prefer>
</alias>
</fontconfig>
mkdir -p ~/.config/autostart/
cat > ~/.config/autostart/input-config.sh <<EOF
#!/bin/sh
set -ex
/usr/bin/xinput --set-prop 'TPPS/2 IBM TrackPoint' 'libinput Accel Speed' -0.6
/usr/bin/setxkbmap -device $(/usr/bin/xinput list --id-only 'AT Translated Set 2 keyboard') -option 'altwin:swap_alt_win,caps:ctrl_modifier'
exit 0
EOF
chmod a+x ~/.config/autostart/input-config.sh
cat > ~/.config/autostart/input-config.desktop <<EOF
[Desktop Entry]
Type=Application
Exec=/bin/sh $HOME/.config/autostart/input-config.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=TrackPoint & Keyboard Configurator
Name=TrackPoint & Keyboard Configurator
Comment[en_US]=Configure TrackPoint & Keyboard
Comment=Configure TrackPoint & Keyboard
EOF
See http://www.thinkwiki.org/wiki/How_to_configure_the_TrackPoint
sudo sh -c 'cat > /etc/udev/rules.d/10-trackpoint.rules <<EOF
KERNEL=="serio2", SUBSYSTEM=="serio", DRIVERS=="psmouse", ATTR{sensitivity}:="170", ATTR{speed}:="85", ATTR{inertia}:="4"
EOF'
Trigger udev rules if needed
sudo udevadm trigger --subsystem-match=serio -v
Show device information
sudo udevadm info -a -p /sys/devices/platform/i8042/serio1/serio2/
sudo sh -c 'cat > /etc/systemd/system/trackpoint-config.service <<EOF
[Unit]
Description=Set TrackPoint attributes
[Service]
ExecStart=/bin/bash /usr/local/bin/trackpoint-config.sh
EOF'
sudo sh -c 'cat > /etc/systemd/system/trackpoint-config.path <<EOF
[Unit]
Description=Watch for, and modify, Trackpoint attributes
[Path]
PathExists=/sys/devices/platform/i8042/serio1/serio2/sensitivity
PathExists=/sys/devices/platform/i8042/serio1/serio2/speed
[Install]
WantedBy=default.target
EOF'
sudo sh -c 'cat > /usr/local/bin/trackpoint-config.sh <<EOF
#!/bin/bash
sleep 3
TPDEV=/sys/devices/platform/i8042/serio1/serio2
echo -n 120 > $TPDEV/sensitivity
echo -n 110 > $TPDEV/speed
logger -t $(basename "$0") "Set TrackPoint attributes complete"
EOF'
sudo systemctl enable trackpoint-config.path
sudo systemctl start trackpoint-config.path
sudo sh -c 'cat > /usr/share/X11/xorg.conf.d/10-synaptics.conf <<EOF
# Disable generic Synaptics device
Section "InputClass"
Identifier "SynPS/2 Synaptics TouchPad"
MatchProduct "SynPS/2 Synaptics TouchPad"
MatchIsTouchpad "on"
MatchOS "Linux"
MatchDevicePath "/dev/input/event*"
Option "Ignore" "on"
EndSection
EOF'
sudo apt-get install imwheel
Run imwheel
when login
cat > ~/.config/autostart/imwheel.desktop <<EOF
[Desktop Entry]
Type=Application
Exec=/usr/bin/imwheel -b "4 5"
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=IMWheel
Name=IMWheel
Comment[en_US]=
Comment=
EOF
sudo apt-get install autofs
sudo cp -a /etc/auto.master /etc/auto.master.ofc
sudo sed -i 's/+auto.master//g' /etc/auto.master
sudo sh -c 'cat >> /etc/auto.master <<EOF
/mnt /etc/auto.nfs --timeout=5 --ghost
+auto.master
EOF'
sudo sh -c 'echo "shared -fstype=nfs,rw,bg,hard,intr,tcp,resvport,nfc,noowners,nolocks,locallocks,noatime,nodiratime 192.168.1.3:/volume1/shared" >> /etc/auto.nfs'
sudo systemctl restart autofs.service && sudo systemctl status autofs.service