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
Last active April 10, 2021 13:26
Hosting FTP in Docker with Docker Desktop under Windows 10

Sneak on docker containers' traffic:

docker run --rm --net=host -v $PWD/tcpdump:/tcpdump kaazing/tcpdump

This will save tcpdump.pcap to tcpdump folder under current directory. That file can be opened with WireShark (sometimes it fails to open the file - check if any concurrent instances of tcpdump container are still running)

Run vsftpd container with mapped volume:

@62mkv
62mkv / README.md
Last active March 25, 2021 09:02
useful JHipster commands

Useful JHipster commands:

How to ensure that your locally developed JHipster is used:

  • remove globally installed "regular" JHipster npm unlink -g generator-jhipster
  • in the "generator-jhipster" folder: npm link (this will link this local folder to global npm node_modules)
  • in the "blueprint" folder: npm link generator-jhipster (this way your locally developed blueprint will also use your locally developed JHipster)
  • in the "blueprint" folder: npm link
  • in the "app" folder: npm link generator-jhipster; npm link <your-blueprint>
@62mkv
62mkv / README.md
Created January 7, 2021 14:22
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
62mkv / README.md
Created December 27, 2020 12:13
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
62mkv / README.md
Last active September 7, 2020 11:55
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="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" exclude-result-prefixes="xs fn xsl"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="http://xlogics.eu/blackbox">
	<!--output format close to xquery-->
@62mkv
62mkv / README.md
Last active May 11, 2024 21:32
OpenStreetMap / OverPass cheatsheet

Find all car repairs services, open on Saturday:

Open http://overpass-turbo.eu/ and paste this into query area, then press "Run"

/*
This has been generated by the overpass-turbo wizard.
The original search was:
“shop=car_repair”
*/
/* 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
62mkv / example.sql
Created May 20, 2020 11:36
How to use XPath against XML text fields with PostgreSQL
/* real-world example */
select xpath('/ns2:PrintData/Meta/Document/@id', xmlparse (document payload),
ARRAY[ARRAY['ns2', 'http://iopm.int.kn/iopm4xml/meta/v1.4']]) 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
62mkv / README.md
Created May 5, 2020 14:19
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
62mkv / README.md
Last active December 1, 2021 10:45
Gradle cookbook

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: https://docs.gradle.org/current/userguide/java_testing.html