Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# place this file in ./.git/hooks
# and remove the prepare-commit-msg.sample file
# Copy the script verify-application-and-ssm-properties.sh to .git/hooks folder
BRANCH_NAME=$(git branch 2>/dev/null | grep -e ^* | tr -d ' *')
if [ -n "$BRANCH_NAME" ]; then
echo "[$BRANCH_NAME] $(cat $1)" > $1
fi
#!/bin/sh
# .git/hooks/commit-msg
NAME=$(git branch | grep '*' | sed 's/* //')
DESCRIPTION=$(git config branch.\"$NAME\".description)
echo \"[$NAME]\"' '$(cat \"$1\") > \"$1\"
if [ -n \"$DESCRIPTION\" ]
then
echo \"\" >> \"$1\"
echo $DESCRIPTION >> \"$1\"
fun main(args: Array<String>) {
// val givenInput = ""
val givenInput = "abc"
fun invertName(name: String): String {
require(name.isNotEmpty()) { "The string must not be empty" } // IllegalArgumentException
val result = name.split("").reversed().joinToString("").substring(1)
check(result.length == name.length) { "Input and output sized should not be different" } // IllegalStateException
assert(name.first() == result.last()) { "The first letter \"${name.first()}\" of the input should be the last one of the output" }
return result
CREATE TABLE movies(
id BIGSERIAL NOT NULL CONSTRAINT movies_pkey, PRIMARY KEY,
title VARCHAR(100) NOT NULL
);
INSERT INTO movies('Movie 1');
INSERT INTO movies('Movie 2');
INSERT INTO movies('Movie 3');
INSERT INTO movies('Movie 4');
INSERT INTO movies('Movie 5');
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("plugin.jpa") version "1.2.71"
id("org.springframework.boot") version "2.1.6.RELEASE"
id("io.spring.dependency-management") version "1.0.7.RELEASE"
kotlin("jvm") version "1.2.71"
kotlin("plugin.spring") version "1.2.71"
}
#!/bin/bash
yum update -y
cd /tmp
wget https://s3.amazonaws.com/amazoncloudwatch-agent/linux/amd64/latest/AmazonCloudWatchAgent.zip -O AmazonCloudWatchAgent.zip
unzip AmazonCloudWatchAgent.zip
sudo ./install.sh -y
rm AmazonCloudWatchAgent.zip
sudo yum install -y java-1.8.0
$ sudo ./amazon-cloudwatch-agent-config-wizard
=============================================================
= Welcome to the AWS CloudWatch Agent Configuration Manager =
=============================================================
On which OS are you planning to use the agent?
1. linux
2. windows
default choice: [1]:
Trying to fetch the default region based on ec2 metadata...
package augustovictor.com.github.cloudwatchagentstatsdcollectd
import com.timgroup.statsd.NonBlockingStatsDClient
import org.slf4j.LoggerFactory
import org.springframework.http.HttpStatus
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
terraform remote config \
-backend=s3 \
-backend-config="bucket=(YOUR_BUCKET_NAME)" \
-backend-config="key=global/s3/terraform.tfstate" \
-backend-config="region=us-east-1" \
-backend-config="encrypt=true"
import org.junit.Assert.assertEquals
import org.junit.Test
import java.text.NumberFormat
import java.util.*
// Example converted from "Refactoring: Improving the Design of Existing Code" book by Martin Fowler.
// From js to Kotlin
class Play(val data: HashMap<String, HashMap<String, String>>)