Skip to content

Instantly share code, notes, and snippets.


Kirill Marchuk 62mkv

  • Kuehne+Nagel
  • Tallinn, Estonia
View GitHub Profile
62mkv /
Created Jan 7, 2021
XPath cheatsheet

XPath cheatsheet

(inspired by this)

Find nodes with XPath expressions

  • / - root
  • x - element named "x"
  • x/y - all children of "x" named "y"
  • * any element
62mkv /
Created Dec 27, 2020
Liquibase + SQLite problem with _temporary tables

How to resolve Liquibase exception "Table 'TABLE_NAME_temporary" not found, when working with SQLite

As it's already second time I face this, here's a brief overview:

Occassionally, constraints in SQLite Database get "corrupted" (maybe it's just me, I dunno), and, when applying migrations, you might come across an exception that looks like this:

Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set db/changelog/changelogs/008-add-lexemes.xml::8-3::62mkv:
     Reason: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.sql.SQLException: Table not found: 'ARTICLES_temporary'
62mkv /
Last active Sep 7, 2020
XLST transformation example

How to extract names and values of parameters from a collection inside XML document

Use Altova XMLSpy. The XLST template example given:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="" xmlns:xs="" xmlns:fn="" exclude-result-prefixes="xs fn xsl"
	<!--output format close to xquery-->
62mkv /
Last active Jul 17, 2020
OpenStreetMap cheatsheet

Find all car repairs services, open on Saturday:

Open and paste this into query area, then press "Run"

This has been generated by the overpass-turbo wizard.
The original search was:
View run-git-commands-in-jenkins-pipeline.groovy
/* using the Jenkins pipeline DSL? We are using */
sshagent([configuration.bitbucketSshCredentialsId]) {
sh "git add ."
sh "git commit -m '$commitComment'
sh "git push $featureBranchName"
/* The credential entry is of type "SSH Username with private key" and the corresponding public key is registered for a technical user in Bitbucket. */
62mkv / example.sql
Created May 20, 2020
How to use XPath against XML text fields with PostgreSQL
View example.sql
/* real-world example */
select xpath('/ns2:PrintData/Meta/Document/@id', xmlparse (document payload),
ARRAY[ARRAY['ns2', '']]) from request_history_step_payload rhsp
join request_history_step rhs on rhs.step_uuid = rhsp.step_uuid
where rhs.step_type = 'PRINTER_REQUEST' and rhs.started_at between '2020-05-19' and now()
62mkv /
Created May 5, 2020
How to catch those flaky tests

Today I've run into situation where some of the tests started failing randomly. Sometimes, 3 times in a row they could be executed successfully, but then would fail.

In order to collect more statistics I created this test.bat:

for /L %%i in (1,1,10) do (
   gradlew clean test
   zip -r0q build%%i build/ 
62mkv /
Created Apr 17, 2020
Gradle tests verbosity

Executing gradle commands with -i seem to seriously enhance debugging experience, especially when tests are failing to initialize (as if when Testcontainers fail to connect to Docker daemon) and there're almost no logs in the JUnit XML reports

./gradlew -i clean test

Also see here:

62mkv /
Created Apr 17, 2020
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 ~/, 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 /
Created Apr 15, 2020
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="" 
    xsi:schemaLocation=" path/to/xsd/file/schema.xsd">

and then click F8

You can’t perform that action at this time.