Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀

Kevin Grüneberg kevcodez

🚀
View GitHub Profile
@kevcodez
kevcodez / gist:0fa6f561315e73c26748dc847e32f113
Created Jun 7, 2020
OAuth 2.0 PKCE Flow with AWS Cognito - Login with public client, like CLI
View gist:0fa6f561315e73c26748dc847e32f113
import {
Issuer,
generators,
Client,
TokenSet,
CallbackParamsType,
} from "openid-client";
const http = require('http');
const issuer = await Issuer.discover('https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_VqitD3cvk/.well-known/openid-configuration')
View jacocoTestCoverage.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><!DOCTYPE report PUBLIC "-//JACOCO//DTD Report 1.0//EN"
"report.dtd">
<report name="pubg-api-wrapper">
<sessioninfo id="Kevins-MacBook-Pro.local-aeb34bc9" start="1534702636504" dump="1534702652857"/>
<sessioninfo id="Kevins-MacBook-Pro.local-88d710fc" start="1534704720654" dump="1534704745021"/>
<package name="de/kevcodez/pubg/model/status">
<class name="de/kevcodez/pubg/model/status/Status">
<method name="getReleasedAt" desc="()Ljava/time/Instant;" line="12">
<counter type="INSTRUCTION" missed="7" covered="0"/>
<counter type="BRANCH" missed="2" covered="0"/>
@kevcodez
kevcodez / build.gradle
Last active Nov 4, 2018
Working build script - Jacoco Code Coverage with Kotlin and Gradle 4.9 and Junit 5
View build.gradle
buildscript {
ext {
kotlin_version = '1.2.71'
junit_version = '5.3.1'
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@kevcodez
kevcodez / ImageScaler.java
Created Jan 14, 2018
Scale images (BufferedImage) in Java to a max height and width
View ImageScaler.java
import java.awt.*;
import java.awt.image.BufferedImage;
public class ImageScaler {
public BufferedImage resizeImage(BufferedImage originalImage, Dimension maxDimension) {
Dimension imageDimensions = new Dimension(originalImage.getWidth(), originalImage.getHeight());
Dimension scaledDimensions = getScaledDimension(imageDimensions, maxDimension);
BufferedImage resizedImage = new BufferedImage(scaledDimensions.width, scaledDimensions.height,
@kevcodez
kevcodez / WasabiFileUploader.java
Last active Sep 29, 2020
Uploading files to Wasabi Cloud Storage using AWS Java SDK
View WasabiFileUploader.java
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.CannedAccessControlList;
@kevcodez
kevcodez / CloseableClient.java
Created Jan 1, 2018
Autocloseable Jax-RS Client
View CloseableClient.java
import java.net.URI;
import java.util.Map;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Configuration;
You can’t perform that action at this time.