Programmatically change drupal 8 config object

To get drupal 8 config object that is mutable (changeable) you need to use config factory to get it and set it. For example 

  $config_factory = \Drupal::configFactory();
  $config = $config_factory->getEditable('system.maintenance');
  $config->set('message', 'bananas');
  $config->save(TRUE);

here we set maintenance message to "bananas" :) . This could be used for some quick debuging locally or maybe you can use this in hook_update for some bigger set of updates like example here to change some config in bulk
https://www.drupal.org/docs/8/api/update-api/updating-configuration-in-…

-----------------------------
To quickly delete all in particular config just run

$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('my_config.settings')->delete();