Skip to content

Instantly share code, notes, and snippets.

@pcolby
Last active April 23, 2024 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcolby/29c4a30339cf753351170aa86d5bf11f to your computer and use it in GitHub Desktop.
Save pcolby/29c4a30339cf753351170aa86d5bf11f to your computer and use it in GitHub Desktop.

Fresh [L]Ubuntu

Just some notes on things I like (or need) to do to make a fresh Ubuntu (or Lubuntu) install usable ;)

Basics

sudo apt install arandr build-essential colordiff curl fonts-noto-color-emoji \
  gawk gpa hunspell-en-au jq keepassxc lcov solaar ssh

Worldclock format

'<b>'h:mm AP'</b><br/><font size="-2">'MMM d'</font>'

Bluetooth

bluetoothctl
list
connect <MAC>
exit

pavucontrol-qt -> Configuration -> Headset -> Headset

Also: sudo apt install blueman for a better (actually works) GUI.

Chrome

Apart of the obvious GUI places:

xdg-settings get default-web-browser # firefox.desktop
grep -Iir firefox.desktop /etc/xdg/ # Multiple mimes.
for m in application/xhtml+xml text/html text/xml x-scheme-handler/http x-scheme-handler/https; do echo -n "$m: "; xdg-mime query default "$m"; done
ls /usr/share/applications/ | grep -i chrome # google-chrome.desktop
for m in application/xhtml+xml text/html text/xml x-scheme-handler/http x-scheme-handler/https; do xdg-mime default google-chrome.desktop "$m"; done
#xdg-settings set default-web-browser google-chrome.desktop # Unnecessary.

Also, to fix corrupted images (eg on nVidia latops):

sudo sed -i -Ee 's|^Exec=/usr/bin/google-chrome-stable|& --disable-gpu-compositing|' \
  /usr/share/applications/google-chrome.desktop 

Qt/C++ Development

sudo apt install clang cmake g++ make qtbase5-dev qt6-base-dev qtconnectivity5-dev qt6-connectivity-dev

And for recent Qt's (6.4+?) via the Qt Online Installer, you often need this too:

sudo apt install libxcb-cursor0

For Doxygen too

sudo apt install graphviz qtbase5-doc-dev qtconnectivity5-doc-html

Git

git config --global init.defaultBranch main
git config --global user.email "git@colby.id.au"
git config --global user.name "Paul Colby"

Lxde Shortcuts

Add Control+Alt+C -> Calculator -> /usr/bin/kcalc shortcut.

Change Show/hine main menu from Super_L to something else, eg Meta + Space (note, Meta is either Super_{L,R} key).

Then add to ~/.config/openbox/rc.xml the contents of keybindings.xml below. (Copy from /etc/xdg/openbox/rc.xml if its not already present).

Finally, openbox --reconfigure.

Kitty

Install kitty:

curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin

Support sudo, run sudo visudo and add:

Defaults env_keep += "TERM TERMINFO"

Also, when SSH'ing to a new host for the first time, setup terminfo via:

kitty +kitten ssh myserver

Audio

In case Lubuntu's GUI mixer (pavucontrol-qt) still segfaults with Bluetooth audio devices:

apt install pulsemixer

LibreOffice

Enable spell-checking.

apt install hunspell-en-au

Postfix

  • Todo: add relay credentials
  • Todo: setup relay host

Create /etc/mailutils.conf with:

address {
  email-domain somedomain.com;
};

QTerminal

Shortcuts

Next Tab: Ctrl+Shift+Right
Prev Tab: Ctrl+Shift+Left
Split H: Ctrl+Shift+/
Split V: Ctrl+Shift+\

Screensaver

Pryo: pyro -root -delay 26549 -count 2000 -frequency 33 -scatter 400

User Directories

Configuration Center -> Session Settings -> User Directories

Lowecase, and move all under ~/media except for ~/doc and ~doc/temmplates.

Slack

Also update Slack, since its too stupid to use the session settings.

File -> Preferences -> Advanced -> Download location -> Change ...

Zoom

sudo apt --fix-broken install ./zoom_amd64.deb

AJV

sudo apt install npm
sudo npm install -g ajv-{cli,formats}

LCOV

If downloading the latest LCOV (eg 2.0+) you might need to:

sudo apt install libcapture-tiny-perl libdatetime-perl

Hibernate

Resize Swapfile

See https://help.ubuntu.com/community/SwapFaq#How_much_swap_do_I_need.3F

cat /proc/swaps
sudo swapoff -a
sudo dd if=/dev/zero of=/swapfile bs=1024 count=$((72*1024*1024)) # 72GiB in this case.
sudo mkswap /swapfile
sudo swapon /swapfile
cat /proc/swaps

Find kernel parameters.

findmnt -no UUID -T /swapfile
# a7cbe1e9-3ee8-4a53-ae20-878e745b573c
sudo filefrag -v /swapfile | head
Filesystem type is: ef53                                                                                                                                    
File size of /swapfile is 77309411328 (18874368 blocks of 4096 bytes)                                                                                       
 ext:     logical_offset:        physical_offset: length:   expected: flags:                                                                                
   0:        0..    2047:   21315584..  21317631:   2048:                  

So: resume=UUID=a7cbe1e9-3ee8-4a53-ae20-878e745b573c resume_offset=21315584

Update GRUB

sudo nano /etc/default/grub
# GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=a7cbe1e9-3ee8-4a53-ae20-878e745b573c resume_offset=21315584"
sudo update-grub
sudo tee /etc/sudoers.d/hibernate <<< 'paul ALL= NOPASSWD: /usr/bin/systemctl hibernate'
<!-- Keybindings for window tiling -->
<keybind key="W-Left">
<action name="Unmaximize"/>
<action name="MoveResizeTo">
<x>0</x>
<y>0</y>
<height>100%</height>
<width>50%</width>
</action>
</keybind>
<keybind key="W-Right">
<action name="Unmaximize"/>
<action name="MoveResizeTo">
<x>-0</x>
<y>0</y>
<height>100%</height>
<width>50%</width>
</action>
</keybind>
<keybind key="W-Up">
<action name="Unmaximize"/>
<action name="MoveResizeTo">
<x>0</x>
<y>0</y>
<width>100%</width>
<height>50%</height>
</action>
</keybind>
<keybind key="W-Down">
<action name="Unmaximize"/>
<action name="MoveResizeTo">
<x>0</x>
<y>-0</y>
<width>100%</width>
<height>50%</height>
</action>
</keybind>
<keybind key="W-Insert">
<action name="Unmaximize"/>
<action name="MoveResizeTo">
<x>0</x>
<y>0</y>
<width>50%</width>
<height>50%</height>
</action>
</keybind>
<keybind key="W-Delete">
<action name="Unmaximize"/>
<action name="MoveResizeTo">
<x>0</x>
<y>-1</y>
<width>50%</width>
<height>50%</height>
</action>
</keybind>
<keybind key="W-Prior">
<action name="Unmaximize"/>
<action name="MoveResizeTo">
<x>-0</x>
<y>0</y>
<width>50%</width>
<height>50%</height>
</action>
</keybind>
<keybind key="W-Next">
<action name="Unmaximize"/>
<action name="MoveResizeTo">
<x>-1</x>
<y>-1</y>
<width>50%</width>
<height>50%</height>
</action>
</keybind>
<keybind key="W-Home">
<action name="Unmaximize"/>
<action name="MoveResizeTo">
<x>center</x>
<y>0</y>
<width>60%</width>
<height>75%</height>
</action>
</keybind>
<keybind key="W-End">
<action name="Unmaximize"/>
<action name="MoveResizeTo">
<x>center</x>
<y>-0</y>
<width>60%</width>
<height>75%</height>
</action>
</keybind>

Precision 3561

#&@^^^@#%# nVidia!!! 😠

prime-select query
sudo prime-select intel

^^ that didn't work. THis maybe did:

sudo apt-get purge nvidia*
sudo apt-get autoremove
# reboot
cat /proc/acpi/bbswitch
# 0000:01:00.0 ON
sudo tee /proc/acpi/bbswitch <<< OFF
# OFF
cat /proc/acpi/bbswitch 
# 0000:01:00.0 OFF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment