Skip to content

Instantly share code, notes, and snippets.

@belgoros
belgoros / TestDouble.java
Created Jun 4, 2021 — forked from hillmanli-seekers/TestDouble.java
BigDecimal vs double: illustration of accuracy and performance impact
View TestDouble.java
import java.math.BigDecimal;
import java.util.function.Consumer;
import java.util.function.DoubleSupplier;
import java.util.stream.DoubleStream;
public class TestDouble {
private static double doubleTotal = 0;
private static double kahanDoubleTotal = 0;
View decoded_token_from_postman.json
{
"exp": 1621497315,
"iat": 1621497015,
"jti": "b390e0bc-292f-423d-9eb9-8eeced0b5272",
"iss": "http://localhost:8080/auth/realms/Demo-Realm",
"aud": "account",
"sub": "aefc221c-1402-41b4-8fb0-4be2eaa003f2",
"typ": "Bearer",
"azp": "springboot-microservice",
"session_state": "93bf159e-c617-4436-9891-a0f0333e37d9",
View decode_token_generated_in_test.json
{
"aud": [
"server"
],
"iat": 1621503452,
"auth_time": 1621503452,
"exp": 1621539452,
"iss": "http://localhost:8080/auth/realms/Demo-Realm",
"sub": "user",
"scope": "openid",
View postman-keycloak.json
{
"info": {
"_postman_id": "55e9873b-b947-49c8-9fca-a98a8ac41587",
"name": "keycloak",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "token-employee1",
"request": {
View demo-realm.json
{
"id": "Demo-Realm",
"realm": "Demo-Realm",
"notBefore": 0,
"revokeRefreshToken": false,
"refreshTokenMaxReuse": 0,
"accessTokenLifespan": 300,
"accessTokenLifespanForImplicitFlow": 900,
"ssoSessionIdleTimeout": 1800,
"ssoSessionMaxLifespan": 36000,
View stored_procedure_service.rb
class StoredProcedureService
def self.instance
@instance ||= StoredProcedureService.new
end
def execute(name, *args)
results = []
begin
connection.execute("CALL #{name}(#{args.join(',')})").each(as: :hash, symbolize_keys: true) do |row|
@belgoros
belgoros / git_configuration.md
Created Aug 31, 2020
Customizing Git - Git Configuration
View git_configuration.md

Customizing Git - Git Configuration

Setup your credentials

git config --global user.name "Firstname Lastname"
git config --global user.email "your.email@example.org"

Avoid merge commits for pulling

@belgoros
belgoros / producer_test_failed.txt
Created Aug 26, 2020
Kafka producer failing test stack trace
View producer_test_failed.txt
➜ kafka-producer-consumer-basics git:(master) ✗ mvn clean test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------< com.codeaches:kafka-producer-consumer-basics >------------
[INFO] Building kafka-producer-consumer-basics 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ kafka-producer-consumer-basics ---
[INFO] Deleting /Users/serguei/projects/java/kafka-producer-consumer-basics/target
[INFO]
@belgoros
belgoros / spring_dynamodb_errors.txt
Created Aug 16, 2020
Spring and DynamoDB integration test errors
View spring_dynamodb_errors.txt
➜ spring-dynamodb-integration git:(master) mvn clean test
[INFO] Scanning for projects...
[INFO]
[INFO] ---< com.nibado.example.spring-testcontainers:spring-testcontainers >---
[INFO] Building spring-testcontainers 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ spring-testcontainers ---
[INFO] Deleting /Users/serguei/projects/java/spring-dynamodb-integration/target
[INFO]
View gist:6a8b233ea70abd449202aa3baecbdffa

Steps to migrate from SVN to GitLab

This process worked for me. I take no responsibility for any damage or loss incurred as a result of following or not following these steps or, for that matter, anything else you might do or not do.

Setup

  • SVN is hosted at svn.domain.com.au.
  • SVN is accessible via http (other protocols should work).
  • GitLab is hosted at git.domain.com.au and: