Terminal Based Progress Bar for Java Applications

Recently I needed to add a progress bar to a Java based terminal/console application and I used a specific library that I’d like to demonstrate in the following snippet. Figure 1. Terminal based Progress Bar for Java Dependencies Using Maven, we just need to add the following dependency: pom.xml <dependency> <groupId>me.tongfei</groupId> <artifactId>progressbar</artifactId> <version>0.7.3</version> </dependency> Sample Application The application shows how to set up the progress bar and how to advance its status by-one, by a given amount or to a specific number. ...

March 31, 2019 · 2 min · 242 words · Micha Kops

AWS Snippets

Install AWS CLI v2 $ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.0.30.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install AWS Documentation Generate Signed URLs with Linux Tools e.g. for accessing a website behind a CloudFront distribution using a canned policy. Write the policy file policy { "Statement": [ { "Resource": "https://xxxxxxxxxxxx.cloudfront.net/", "Condition": { "DateLessThan": { "AWS:EpochTime": 1648293147 } } } ] } Then apply the following commands[1] - you need to have OpenSSL installed. cat policy | tr -d "\n" | (1) tr -d " \t\n\r" | (2) openssl sha1 -sign private_key.pem | (3) openssl base64 -A | (4) tr -- '+=/' '-_~' (5) ...

March 1, 2018 · 2 min · 371 words · Micha Kops

Creating Microservices with Bootique

When it comes to writing microservices in Java, plenty of tools and frameworks exist. In the following tutorial, I’d like to demonstrate another minimalistic framework called Bootique by implementing a simple microservice exposing its functions either as a RESTful web-service or as a runnable command executed using the command line. Bootique Command Line Dependencies Using Maven here, we’re adding the following elements to our project’s pom.xml: Bootiques Bill of Materials as dependency management: bootique-bom Bootique Jersey for our REST service: bootique-jersey Bootique Logback for logging: bootique-logback Maven Shade Plugin to assemble our fat-jar ...

September 18, 2016 · 6 min · 1070 words · Micha Kops

Maven Snippets

Extract Coordinates from the POM Helpful for build and integration environments, pipelines etc. Exctract the Project version from the pom.xml mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout Override a Property via local configuration e.g. to override the property xxx from your project’s pom.xml Create a directory .mvn in your project directory root Create a file named maven.config in this directory Insert -Dxxx=newvalue into the file to override this property Don’t forget to add .mvn to your .gitignore! ...

March 1, 2010 · 2 min · 401 words · Micha Kops

Rust Snippets

Installation Installing rustup first…​ install rustup via shell script curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh install rustup via brew brew install rustup-init (1) rustup-init (2) Welcome to Rust! [...] Current installation options: default host triple: aarch64-apple-darwin default toolchain: stable (default) profile: default modify PATH variable: yes 1) Proceed with standard installation (default - just press enter) 2) Customize installation 3) Cancel installation 1 install rustup 2 install rust binaries and add them to paths etc…​ ...

March 1, 2010 · 1 min · 111 words · Micha Kops