How to detect and activate hot added MEMORY, CPU and DISK resources

Sometimes hot added MEMORY, CPU and DISK resources are not detected right away by Linux, or atleast not enabled the moment they are added.
With these bash snippets you can detect and enable hot added resources.

Hot added MEMORY resources

To detect/enable all (offline) hot added Memory resources run this bash snippet:

# MEMORY
grep -l offline /sys/devices/system/memory/*/state | while read line; do
  echo "online" > ${line}
done

Hot added CPU resources

To detect/enable avaible CPU cores run this bash snippet:

# CPU
grep -l 0 /sys/devices/system/cpu/cpu*/online | while read line; do
  echo "1" > ${line}
done

Hot added DISK resources

To detect/enable available DISk resources run this bash snippet:

# DISK
for scsi in /sys/class/scsi_device/*/device/rescan; do
  echo 1 > ${scsi}
done

All at once:

# MEMORY
grep -l offline /sys/devices/system/memory/*/state | while read line; do echo "online" > ${line}; done
# CPU
grep -l 0 /sys/devices/system/cpu/cpu*/online | while read line; do echo "1" > ${line}; done
# DISK
for scsi in /sys/class/scsi_device/*/device/rescan; do echo 1 > ${scsi}; done