This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.springframework.batch.core.* | |
| @Grab('org.springframework.batch:spring-batch-core:3.0.6.RELEASE') | |
| import org.springframework.batch.core.configuration.annotation.* | |
| import org.springframework.batch.core.job.builder.FlowBuilder | |
| import org.springframework.batch.core.job.flow.Flow | |
| import org.springframework.batch.core.launch.JobLauncher | |
| import org.springframework.batch.core.listener.ExecutionContextPromotionListener | |
| import org.springframework.batch.core.partition.support.Partitioner | |
| import org.springframework.batch.core.scope.context.ChunkContext | |
| import org.springframework.batch.core.scope.context.StepSynchronizationManager |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Configuration file | |
| general { | |
| S:config < | |
| #########Comments are prefixed with '#' | |
| ######### | |
| ###Amounts can vary, there are percentages (%) and seconds (s) | |
| ###Anything outside is considered a default | |
| ###You can put spaces to make it look better | |
| min_level: 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package advent | |
| object Day9 { | |
| def main(args: Array[String]): Unit = { | |
| import File._ | |
| def findPair(array: List[Long], num: Long) = { | |
| @scala.annotation.tailrec | |
| def recursiveFindPair(l: Int, r: Int): Option[(Long, Long)] = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package advent | |
| object Day8 { | |
| def main(args: Array[String]): Unit = { | |
| import File._ | |
| def execute1(operations: Seq[(String, Int)]): Int = { | |
| @scala.annotation.tailrec | |
| def recursive(pointer: Int, result: Int)(visits: Array[Int]): Int = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package advent | |
| object Day7 { | |
| def main(args: Array[String]): Unit = { | |
| import File._ | |
| def find(map: Map[String, Seq[String]], current: String)(lookup: String): Boolean = { | |
| map(current).distinct match { | |
| case seq@_ => if(seq.contains(lookup)) true else seq.exists(find(map, _) {lookup}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package advent | |
| object Day6 { | |
| def main(args: Array[String]): Unit = { | |
| import File._ | |
| def concat(last: String, next: String) = { | |
| if (next.isEmpty) last + " " | |
| else last + next |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package advent | |
| object Day5 { | |
| def main(args: Array[String]): Unit = { | |
| import File._ | |
| def floor(a: Int, b: Int) = ((b - a) / 2).floor.toInt | |
| def ceil(a: Int, b: Int) = ((b - a) / 2).ceil.toInt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package advent | |
| object Day4 { | |
| def main(args: Array[String]): Unit = { | |
| import File._ | |
| def validate(data: String): Boolean = { | |
| data.split(':') match { | |
| case Array(a, b) => a match { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package advent | |
| object Day3 { | |
| def main(args: Array[String]): Unit = { | |
| import File._ | |
| def hasTree(line: String, pos: Int): Boolean = line(pos % line.length) == '#' | |
| println({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package advent | |
| import scala.util.matching.Regex | |
| object Day2 { | |
| val regex: Regex = "(\\d+-\\d+) ([a-z]): ([a-z]*)".r | |
| def main(args: Array[String]): Unit = { | |
| import File._ |
NewerOlder