Skip to content

Instantly share code, notes, and snippets.

View login
package com.knoldus.user;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import java.util.Scanner;
import java.util.Set;
public class Login {
View user
package com.knoldus.user;
import com.knoldus.user.annotation.Password;
import lombok.Builder;
import lombok.Value;
import javax.validation.constraints.Pattern;
@Value
@Builder
View passwordValidation
package com.knoldus.user.annotation;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
public class PasswordValidation implements ConstraintValidator<Password, String> {
private static final boolean NUMBER_OF_REQUIRED_DIGITS = true;
View password
package com.knoldus.user.annotation;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
View json
{
"voyageLines": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
View packer
#!/usr/bin/env bash
set -e
usage() {
echo "environment variable AWS_PROFILE or access keys (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) to be set"
exit 1
}
if [ ${#} -ne 2 ]; then
View vars
variable "AWS_ACCESS_KEY" {}
variable "AWS_SECRET_KEY" {}
variable "region" {
default="us-east-1"
}
variable "image_name" {
default = "ami_image_name"
}
View terraform
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["${var.image_name}"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
View terraform.sh
cd terraform
ssh-keygen -f mykey
terraform init
terraform plan\
-out out.terraform
terraform apply out.terraform
rm out.terraform KEY
View build.sh
#!/usr/bin/env bash
echo "*** Deployment started"
usage() {
echo "(AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) to be set"
exit 1
}
if [ ${#} -ne 2 ]; then
usage
fi