Ubuntu Battery Saver TLP and Slimbook

Refer: https://ubuntuhandbook.org/index.php/2020/06/improve-battery-life-ubuntu-20-04-lts/
Refer: https://www.omgubuntu.co.uk/2021/10/slimbook-battery-4-released

How to Install TLP in Ubuntu 20.04

Simply open terminal either from application menu or by pressing Ctrl+Alt+T on keyboard. When terminal opens, run command:

sudo apt install tlp

Install Slimbook Battery from its official PPA

Run following commands in terminal one by one in terminal:

sudo add-apt-repository ppa:slimbook/slimbook
sudo apt update
sudo apt install slimbookbattery

Remove Slimbook and TLP

sudo add-apt-repository --remove ppa:slimbook/slimbook
sudo apt remove --autoremove slimbookbattery
sudo apt remove --autoremove tlp

Install VMWare Tools

From Ubuntu 20.04, need to reinstall from the terminal

sudo apt-get autoremove open-vm-tools
sudo apt-get autoremove open-vm-tools-desktop
sudo apet-get update
sudo apt-get install open-vm-tools
sudo apt-get install open-vm-tools-desktop
reboot

After the reboot copy/paste and drag/drop will work!

NOTE: If you are having troubles with the clipboard working between the host and guest, shut everything down, include the VMWare application and then restart everything.

Ubuntu 22.04

Note: You will need to be OFF the VPN

Refer: https://installati.one/ubuntu/22.04/open-vm-tools-dev/

Install open-vm-tools-dev Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install open-vm-tools-dev using apt-get by running the following command:

sudo apt-get -y install open-vm-tools-dev

Install open-vm-tools-dev Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install open-vm-tools-dev using apt by running the following command:

sudo apt -y install open-vm-tools-dev

VirtualBox Build Essentials

When you insert the guest editions you get a warning about not being able to build the kernel

Run this first

sudo apt-get install build-essential gcc make perl dkms

Stop being prompted to unlock the ‘default’ keyring

The simplest way is to set the password for the keyring to an empty password -- you will not be prompted for a password then:

  • Open Applications -> Accessories -> Password and Encryption Keys.
  • Right-click on the "login" keyring.
  • Select "Change password"
  • Enter your old password and leave the new password blank.

Temporarily Force Ubuntu to IPV4

Refer: https://linuxconfig.org/how-to-disable-ipv6-address-on-ubuntu-20-04-lts-focal-fossa

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

The above commands will temporarily disable IPv6, meaning that the settings will not persist after reboot. To re-enable IPv6 reboot your system or execute the above commands again however reverse the logic and change 1 to 0

In case you need more permanent solution to disable IPv6 even after system reboot follow the steps below:

As an administrative user open up the /etc/default/grub file using your favourite text editor and make to following changes:

FROM:
GRUB_CMDLINE_LINUX_DEFAULT=""
TO:
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"

Once ready update Grub menu:

sudo update-grub

In case you need to re-enable the IPv6 network addresses simply remove the ipv6.disable=1 from the /etc/default/grub file and run the update-grub command.

Compress Ubuntu Disk Space in Parallels or VirtualBox

If you have setup your parallels as an expanding disk, which might perform a little less but our solid state drives can handles this. You can delete your snapshot and fill all of your deleted space with zeros. This allows the reclaim disk feature of parallels to work. I was able to recover about 20GB of disk space. My 65GB hard drive was taking 75GB of space due to snapshot.

Windows Tool

SDelete (Local Copy) SDelete.zip
https://technet.microsoft.com/en-us/sysinternals/bb897443 (Original Location)

sdelete.exe c: -z

Linux Tool

Then go into sudo and run the sfill command, let it run and you will get a warning about being out of space, but it will be okay.

sudo apt-get install secure-delete
sudo su -
sfill -l -l -z -v /

VirtualBox Compression

VBoxManage list hdds

VBoxManage modifymedium disk "/home/mruckman/VirtualBox VMs/Windows10/Windows10 Clone.vdi" --compact

VBoxManage modifymedium disk "/home/mruckman/VirtualBox VMs/Ubuntu 22.04/Ubuntu 22.04.vdi" --compact

VBoxManage modifymedium disk "/home/mruckman/VirtualBox VMs/Ubuntu 22.04 Docker/Ubuntu 22.04 Docker Machine.vdi" --compact

Windows

You need to open a command prompt and NOT a PowerShell terminal

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd "C:\Users\mruckman\VirtualBox VMs\Ubuntu 22.04\Ubuntu 22.04.vdi" --compact
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd "C:\Users\mruckman\VirtualBox VMs\Ubuntu 22.04 Docker\Ubuntu 22-disk001.vdi" --compact

After you're done, take a new snapshot.

You can try this method instead, it does not require any additional installation:

Refer: https://forum.parallels.com/threads/tip-how-to-compact-your-virtual-disks-when-using-linux-guests.29829/

$ dd if=/dev/zero of=deleteme bs=1M

Virtual Box is a bit different OLDER Deprecated

Refer: http://splatoperator.com/2012/07/compacting-a-vmdk-virtual-machine-disk-format-image/

Zero out the free space
Clone the VMDK
Attach new drive

$ VBoxManage clonehd $disk_name.vmdk clone.vmdk

$ /usr/local/bin/vboxmanage clonehd "/Users/mauriceruckman/VirtualBox VMs/Ubuntu-14.04-HAL-UI-35GB/Ubuntu-14.04-HAL-UI-35GB-disk1.vmdk" "/Users/mauriceruckman/VirtualBox VMs/Ubuntu-14.04-HAL-UI-35GB/Ubuntu-14.04-HAL-UI-35GB-20160812-disk1.vmdk"

Google Chrome Recorder Tutorial – run Puppeteer tests from CLI

Refer: https://www.youtube.com/watch?v=DrUZmvS10Os

Use DistroBox to Install Locally

Refer: https://postsrc.com/code-snippets/how-to-install-latest-stable-chrome-version-in-ubuntu-puppeteer

Step 1: Download Setup with cURL

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

Step 2: Install Required Ubuntu Dependency

sudo apt-get install -y nodejs gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev libxshmfence-dev

Step 3: Install Puppeteer

sudo npm install --global --unsafe-perm puppeteer

Step 4: Run the file

node file-to-run.js


Older Instructions

sudo apt-get install -y nodejs
sudo apt-get install -y npm
npm i puppeteer

sudo apt-get install -y nodejs
sudo apt-get install -y npm