You can also temporarily disable sleep from the command line with "caffeinate" regardless of the sleep settings in system preferences.
The basic function of caffeinate when run without any arguments it to prevent active sleep while caffeinate is running:
It will prevent active sleep until you stop caffeinate with "Control + C" or kill all caffeinate processes. After termination the MacBook will resume its normal behaviour (perfect for a computational intensive task)
You can also run caffeinate for a specific pre-determined amount of time to prevent sleeping for that specific amount of time e.g. 4 hours (specify time in seconds) - The ampersand makes the terminal run the process in the background so you continue working.
caffeinate -t 144000 &
Caffeinate can also be attached to other commands to prevent the MacBook from sleeping while the given command is being executed:
caffeinate [command_to_run] -arguments
For a full list of options please refer to the man-page