def smallest_multiple(n): """ :param n: a positive integer :return: the smallest positive integer that is a multiple of both 2 and n """ lcm = n while lcm % 2 != 0: lcm += n return lcm # example inputs print(smallest_multiple(5)) print(smallest_multiple(6))
To install VirtualBox Guest Additions in Ubuntu, follow the steps given below: Step 1: Update Ubuntu System Open the terminal using the shortcut key "Ctrl+Alt+T" and run the following command to update Ubuntu. ``` sudo apt-get update ``` Step 2: Install Required Packages Install the required packages to mount the Guest Additions CD. ``` sudo apt-get install build-essential dkms linux-headers-$(uname -r) ``` Step 3: Install VirtualBox Guest Additions Now, insert the virtualbox guest additions CD from devices tab and then run the installer using the following command: ``` sudo sh /media/$USER/VBOXADDITIONS_$(VBoxManage -v | cut -d 'r' -f 1).iso ``` The above command mounts the VirtualBox Guest Additions CD to the virtual machine and launches the installer script. Follow the on-screen instructions to complete the installation. Step 4: Restart the Virtual Machine After successful installation, restart the virtual machine to apply the changes. ``` sudo reboot ``` Once the virtual machine is rebooted, VirtualBox Guest Additions will be installed on it.
#!/bin/bash # Script to check free space on all disks and notify if less than 50GB for disk in $(df -h | awk '{print $1}' | grep "^/dev"); do used=$(df -h --output=used "$disk" | sed 1d | tr -d "[:space:]") free=$(df -h --output=avail "$disk" | sed 1d | tr -d "[:space:]") if [ ${free%?} -lt 50 ]; then echo "Warning: Disk $disk is low on free space. Only $free left." fi done echo "Done."