View PascalsTriangle.scala
object PascalsTriangle extends App { | |
/** | |
* 1 | |
* 1 1 | |
* 1 2 1 | |
* 1 3 3 1 | |
* 1 4 6 4 1 | |
* | |
*/ |
View Exceptionhandler
@ControllerAdvice(annotations = RestController.class) | |
public class ExceptionHandlerAdvice { | |
@ExceptionHandler(InvalidDataException.class) | |
@ResponseStatus(HttpStatus.BAD_REQUEST) | |
public ResponseEntity<String> handleInvalidDataExceptions(InvalidDataException e) { | |
HttpHeaders headers = new HttpHeaders(); | |
headers.setContentType(MediaType.TEXT_PLAIN); | |
return new ResponseEntity<>(e.getMessage(), headers, HttpStatus.BAD_REQUEST); | |
} |
View IAM Role based Service Account Creation
#!/bin/bash | |
CLUSTER_NAME=`eksctl get cluster --region ap-southeast-2 -o json | jq -r '.[0].name'` | |
ISSUER_URL=$(aws eks describe-cluster \ | |
--name $CLUSTER_NAME \ | |
--query cluster.identity.oidc.issuer \ | |
--output text \ | |
--region ap-southeast-2) | |
ISSUER_HOSTPATH=$(echo $ISSUER_URL | cut -f 3- -d'/') | |
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) |
View jenkins_build_jenkinsfile
node { | |
def mvnHome | |
env.JAVA_HOME="${tool 'JDK12'}" | |
env.MAVEN_HOME="${tool 'M3'}" | |
env.PATH="${env.JAVA_HOME}/bin:${env.MAVEN_HOME}/bin:${env.PATH}" | |
stage('Checkout source') { | |
git( | |
url: "${repo}", | |
credentialsId: "${GithubCredentialsId}", |