Skip to content

Instantly share code, notes, and snippets.

@entzik
entzik / User.hs
Last active September 7, 2020 21:47
Sample DAML Contract Template
module User where
template User with
username: Party
following: [Party]
where
signatory username
observer following
agreement
@entzik
entzik / gradle.yaml
Created November 5, 2019 14:09
HitHub Action file
name: Java CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
@entzik
entzik / build.gradle.kts
Created October 28, 2019 17:30
Jar signing configuration
signing {
val PGP_SIGNING_KEY: String? by project
val PGP_SIGNING_PASSWORD: String? by project
useInMemoryPgpKeys(PGP_SIGNING_KEY, PGP_SIGNING_PASSWORD)
sign(publishing.publications["mavenJava"])
}
@entzik
entzik / build.gradle.kts
Created October 28, 2019 16:54
Publishing configuration for maven central
val MAVEN_UPLOAD_USER: String by project
val MAVEN_UPLOAD_PWD: String by project
publishing {
repositories {
maven {
name = "MavenCentral"
val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
val snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
@entzik
entzik / build.gradle.kts
Created October 28, 2019 16:47
Tasks to build source and javadoc jars with gradle
tasks.register<Jar>("sourcesJar") {
archiveClassifier.set("sources")
from(sourceSets.main.get().allJava)
}
tasks.register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
from(tasks.javadoc.get().destinationDir)
}
@entzik
entzik / build.gradle.kts
Created October 28, 2019 16:43
gradle plugins required for maven publishing
plugins {
// Apply the java-library plugin to add support for Java Library
`java-library`
`maven-publish`
signing
...
}
@entzik
entzik / create-lambda-function.sh
Created May 31, 2018 21:42
A shell script to create and deploy AWS lambda function
#!/bin/sh
aws lambda create-function \
--function-name ClimateMonitor \
--region eu-west-3 \
--zip-file fileb://build/libs/iot-home-climate-monitoring-1.0.0.BUILD-SNAPSHOT-aws.jar \
--role arn:aws:iam::603595916284:role/climate-monitor-role \
--handler com.thekirschners.iot.home.monitoring.Handler \
--environment Variables="{DB_HOST_NAME=localhost,DB_USERNAME=postgres,DB_PWD=password}" \
--runtime java8 \
@entzik
entzik / create-database.sh
Created May 31, 2018 21:33
A shell script to create a postgres database on AWS RDS
#!/bin/sh
aws rds create-db-instance \
--db-instance-identifier HomeAutomationDB \
--db-instance-class db.t2.micro \
--region eu-west-3 \
--engine postgres \
--allocated-storage 5 \
--no-publicly-accessible \
--db-name homeautomation \
@entzik
entzik / homeautomation-v1.xml
Created May 30, 2018 21:53
liqubase change log
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet id="2" author="ek">
<createTable tableName="climate_reading">
@entzik
entzik / application.properties
Created May 30, 2018 21:48
liquibase properties
liquibase.change-log=classpath:/db/liquibase-changelog.xml
liquibase.enabled=true