Last active
May 23, 2020 15:47
-
-
Save liyafe1997/90b97c4391de97925b6a739ea6f81ec9 to your computer and use it in GitHub Desktop.
Ubuntu Linux notes
This file contains hidden or 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
1. Enable Custom Touchpad setting (But seems only work with gnome-flashback&metacity) | |
In /usr/share/X11/xorg.conf.d/51-synaptics-userdefined.conf | |
Section "InputClass" | |
Identifier "touchpad catchall" | |
Driver "synaptics" | |
MatchIsTouchpad "on" | |
Option "LockedDrags" "true" | |
Option "PalmDetect" "true" | |
Option "HorizTwoFingerScroll" "true" | |
MatchDevicePath "/dev/input/event*" | |
EndSection | |
2. Hibernate | |
You have to use a swap partition | |
and set /etc/default/grub CMD_LINUX resume=swappartition | |
sudo pm-hibernate to test | |
show the menu in gnome:sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla | |
paste following content and save it. | |
[Re-enable hibernate by default in upower] | |
Identity=unix-user:* | |
Action=org.freedesktop.upower.hibernate | |
ResultActive=yes | |
[Re-enable hibernate by default in logind] | |
Identity=unix-user:* | |
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit | |
ResultActive=yes | |
3. Clipboard history | |
sudo apt-get install clipit | |
4. hpfall | |
just make and put in /etc/rc.local | |
5. NVIDIA | |
optirun xxxx use nvidia card to run program | |
prime-select seems doesn't work(always use intel even selected nvidia) | |
6.HDMI | |
https://zhuanlan.zhihu.com/p/133874045 | |
use intel-virtual-output to make HDMI work with bumblebee | |
how does it works? /etc/X11/xorg.conf.d/20-intel.conf : | |
Section "Device" | |
Identifier "Intel Graphics" | |
Driver "intel" | |
Option "VirtualHeads" "2" | |
EndSection | |
The most important is Option "VirtualHeads" "2" | |
And some configuration in /etc/bumblebee/xorg.conf.nvidia | |
Most important: | |
Option "UseEDID" "true" | |
#Option "UseDisplayDevice" "none" | |
Option "AllowEmptyInitialConfiguration" | |
#Option "ConnectedMonitor" "DFP" | |
"AutoAddDevices" "true" | |
Full config: | |
Section "ServerLayout" | |
Identifier "Layout0" | |
Option "AutoAddDevices" "true" | |
Option "AutoAddGPU" "false" | |
EndSection | |
Section "Device" | |
Identifier "DiscreteNvidia" | |
Driver "nvidia" | |
BusID "PCI:01:00:0" | |
VendorName "NVIDIA Corporation" | |
# If the X server does not automatically detect your VGA device, | |
# you can manually set it here. | |
# To get the BusID prop, run `lspci | egrep 'VGA|3D'` and input the data | |
# as you see in the commented example. | |
# This Setting may be needed in some platforms with more than one | |
# nvidia card, which may confuse the proprietary driver (e.g., | |
# trying to take ownership of the wrong device). Also needed on Ubuntu 13.04. | |
# BusID "PCI:01:00:0" | |
# Setting ProbeAllGpus to false prevents the new proprietary driver | |
# instance spawned to try to control the integrated graphics card, | |
# which is already being managed outside bumblebee. | |
# This option doesn't hurt and it is required on platforms running | |
# more than one nvidia graphics card with the proprietary driver. | |
# (E.g. Macbook Pro pre-2010 with nVidia 9400M + 9600M GT). | |
# If this option is not set, the new Xorg may blacken the screen and | |
# render it unusable (unless you have some way to run killall Xorg). | |
Option "ProbeAllGpus" "false" | |
Option "NoLogo" "true" | |
Option "UseEDID" "true" | |
#Option "UseDisplayDevice" "none" | |
Option "AllowEmptyInitialConfiguration" | |
#Option "ConnectedMonitor" "DFP" | |
EndSection | |
Section "Screen" | |
Identifier "Default Screen" | |
Device "DiscreteNvidia" | |
EndSection | |
/etc/bumblebee/bumblebee.conf: | |
KeepUnusedXServer=true | |
7. x0vnc | |
#This is a vnc server that can connect to current xserver session. It run automatically by gnome startup application. It listen :0(vnc port :5900) vnc port and use default vnc password. | |
Now I not use x0vnc, I use gnome setting->sharing->screen share to replace it. | |
But it need disable encryption, otherwise some vnc client like xrdp unable to connect: | |
dconf write /org/gnome/desktop/remote-access/require-encryption false | |
8. Prevent turn on airplane mode when close lid | |
/etc/systemd/system/hp-keycodes.service | |
[Unit] | |
Description=HP setkeycodes fix | |
[Service] | |
Type=oneshot | |
Restart=no | |
RemainAfterExit=no | |
ExecStart=/usr/bin/setkeycodes e057 240 e058 240 | |
[Install] | |
WantedBy=rescue.target | |
WantedBy=multi-user.target | |
WantedBy=graphical.target | |
sudo systemctl daemon-reload | |
sudo systemctl enable hp-keycodes.service | |
9. IPV4 First | |
/etc/gai.conf | |
uncomment precedence ::ffff:0:0/96 10 | |
10. Lightdm numlock auto turn on | |
/usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf | |
Add: | |
greeter-setup-script=/usr/bin/numlockx on | |
11. v2ray | |
installed this https://github.com/jiangxufeng/v2rayL | |
12.xrdp | |
changed port to 63389. It can connect to -x0vnc-(127.0.0.1:5900) (now replace with gnome screen sharing) | |
13. Modify file watchs for vscode | |
/etc/sysctl.conf | |
fs.inotify.max_user_watches=524288 | |
(https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc) | |
14.ibus-rime | |
The main reason use this IME is wubi in ibus-table not good. In chrome unable to switch language, and all symbol in chinese mode is full size. worAnyway, not good. | |
rime is a very good workaround to use wubi. and config ~/.config/ibus/rime/default.yaml to make it only have "wubi86". | |
14.nm-applet | |
It's gnome classic network manager system tray icon. It's easy to modify network setting and view net infomation. So put it in gnome startup application. | |
15.disableNvidia.sh | |
It's use for restart nvidia card. I have put it in gist. | |
16.backup /home | |
7za a -t7z -mhe -mmt5 -pPASSWORD -xr\!.cache -xr\!.mozilla -xr\!.ccache -xr\!.nv -xr\!.gvfs -xr\!.dbus -xr\!vmware -xr\!Steam -xr\!TelegramDesktop /media/liyafe1997/Data/Downloads/homebackup$(date +%Y-%m-%d-%H-%M-%S).7z /home/liyafe1997 | |
17.Enable SSH Forward X11 | |
/etc/ssh/ssh_config | |
ForwardAgent yes | |
ForwardX11 yes | |
ForwardX11Trusted yes | |
18.Let QT5 Program use GTK theme | |
https://askubuntu.com/questions/706528/qt-apps-stopped-inheriting-gtk-themes/748186#748186 | |
Install qt5-style-plugins | |
Add QT_QPA_PLATFORMTHEME=gtk2 to /etc/profile.d/appmenu-qt5.sh | |
19.redsocks | |
It can work with iptables to redir all traffic to a socks5 proxy. /etc/redsock.conf config the port of socks5 proxy and redsocks proxy | |
I disabled autostart redsocks in systemd. So it need to start maunally: sudo systemctl start redsocks | |
To make all 80,443 OUTPUT to redsocks : | |
sudo iptables -t nat -A OUTPUT -p tcp --dport 443 -j REDIRECT --to 1082 | |
sudo iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to 1082 | |
To restore | |
sudo iptables -t nat -F | |
20.trash-cli | |
To prevent rm -rf | |
sudo apt install trash-cli | |
put alias rm='trash' in ~/.bashrc and /root/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment