First, create an empty conf using this code:
val sc = new SparkContext(new SparkConf())
Then, you can supply configuration values at runtime. For example:
./bin/spark-submit --name "My app" --master local[4] --conf spark.eventLog.enabled=false
--conf "spark.executor.extraJavaOptions=-XX:+PrintGCDetails -XX:+PrintGCTimeStamps" myApp.jar