Auto Populate ACF Select and Checkboxes

Sometimes I need an ACF Select or Checkbox field to be populated dynamically. Sometimes I need to populate it with some Custom Post Types or perhaps another ACF repeater field.

Here is the code I found for this.

You could also do the same thing but with custom post types like this: