Skip to content

Instantly share code, notes, and snippets.

View 62mkv's full-sized avatar

Kirill M 62mkv

  • Breakwater Technology
  • Tallinn, Estonia
View GitHub Profile
@62mkv
62mkv / README.md
Created April 17, 2020 16:09
Tricky Testcontainers execution case (Jenkins, Docker, and tests failing under Gradle)

The excerpt from logs:

 14:56:01.405 [Test worker] INFO  org.testcontainers.dockerclient.DockerClientProviderStrategy - Loaded org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy from ~/.testcontainers.properties, will try it first
    14:56:01.942 [ducttape-0] DEBUG org.testcontainers.dockerclient.DockerClientProviderStrategy - Pinging docker daemon...
    14:56:01.987 [ducttape-0] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd: 
    14:56:02.699 [ducttape-0] DEBUG org.testcontainers.dockerclient.DockerClientProviderStrategy - Pinging docker daemon...
    14:56:02.699 [ducttape-0] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd: 
    14:56:03.200 [ducttape-0] DEBUG org.testcontainers.dockerclient.DockerClientProviderStrategy - Pinging docker daemon...
    14:56:03.209 [ducttape-0] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd: 
    14:56:03.712 [ducttape-0] DEBUG org.testcontainers.dockerclient.DockerClientProviderStrategy - Pin
@62mkv
62mkv / README.md
Created April 15, 2020 14:41
How to validate an XML document with XMLSpy

Ensure that root element of the XML file will contain something like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:PrintData xmlns:ns2="http://iopm.int.kn/iopm4xml/meta/v1.4" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://iopm.int.kn/iopm4xml/meta/v1.4 path/to/xsd/file/schema.xsd">

and then click F8

@62mkv
62mkv / README.md
Last active March 15, 2022 15:00
PowerShell cheatsheet

Getting help on any topic:

help _topic_

or

man _topic_

Read all lines from text file

@62mkv
62mkv / README.md
Created March 6, 2020 10:10
Docker Desktop is not respecting proxy settings under Windows 10 Professional

Docker Desktop is not respecting proxy settings under Windows 10 Professional

SOLUTION:

  • Option 1:configure Docker Desktop to use Manual proxy settings: the "whale" context menu / Settings / Resources / Proxies / Manual proxy configuration
  • Option 2: (might work, didn't test) set HTTP_PROXY / HTTPS_PROXY / NO_PROXY as system environment variables, not user ones

In both cases, restart Docker Server

Original Problem:

@62mkv
62mkv / README.md
Last active July 28, 2020 06:59
Java useful tips

To wire-print requests/responses over HTTP for SOAP/XML:

-Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true -Dcom.sun.xml.ws.transport.http.HttpAdapter.dump=true -Dcom.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump=true -Dcom.sun.xml.internal.ws.transport.http.HttpAdapter.dump=true -Dcom.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold=true

Snippet to quickly get Java system properties:

public class My {
  public static void main(String[] argc) {
 System.getProperties().stringPropertyNames().forEach(name -&gt; System.out.println(name + "=" + System.getProperty(name)));
@62mkv
62mkv / README.md
Last active December 14, 2023 13:14
Wikidata SPARQL queries

Examples of SPARQL Wikidata queries:

List of hills in Estonia without defined elevation

SELECT ?item ?itemLabel ?geo ?elevation WHERE {
  ?item wdt:P31 wd:Q54050;
    wdt:P17 wd:Q191;
        wdt:P625 ?geo.
    OPTIONAL { ?item wdt:P2044 ?elevation }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "et" } 
@62mkv
62mkv / README.md
Created October 11, 2019 08:46
How to add a custom trusted certificate for making HTTP requests against external sites

Thoughts on how to add trusted store for connection to external sites that use that certificate for HTTPS

Option 1: global configuration

One can just provide the -Djavax.net.ssl.trustStore=<path/to/store> -Djavax.net.ssl.trustStorePassword=<password> options when running the Java application

However, this is not always possible (for example, when run in the cloud).

And if you want to use server.ssl.trust-store/server.ssl.trust-store-password options from Spring Boot, be aware that with those you also have to provide key-store options as well. And, basically that would be an abuse, because this configuration is specifically for server side of your application.

@62mkv
62mkv / playground.rs
Created August 4, 2019 21:14 — forked from rust-play/playground.rs
Code shared from the Rust Playground
//! [dependencies]
//! fstrings = "0.1.4"
//! itertools = "0.8.0"
//! lazy_static = "1.3.0"
//! libc = "0.2.60"
//! libloading = "0.5.2"
#[macro_use] extern crate fstrings;
use ::std::{*,
@62mkv
62mkv / README.md
Last active October 25, 2021 21:47
How to debug SSL issues with Java-based server application

How to debug an HTTPS connection issue with Spring Boot based Java application

  1. Advanced logging:
  • java -jar -Djavax.net.debug=ssl:handshake:verbose app.jar
  1. make sure you specify correct configuration:
  • java -jar -Djavax.net.debug=ssl:handshake:verbose app.jar --server.port=8443 --server.security.require-ssl=true --server.ssl.key-store=/path/to/keystore --server.ssl.key-store-password=password --server.ssl.protocol=TLS
  1. See what’s in the store:
  • keytool -list -keystore /path/to/keystore -storepass password

It's very annoying when you write some code at work, say, reproducible cases for OSS issues, but then commit those under work-related credentials and push on GH

To avoid this from happening, I've wrote such a pre-push hook and put it into .git-templates folder (see recipe on global hooks)

#!/bin/bash -e
#
# Git pre-push hook that blocks push if commits are authored or committed using non-personal credentials
#
# Source: https://github.com/git/git/blob/87c86dd14abe8db7d00b0df5661ef8cf147a72a3/templates/hooks--pre-push.sample