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 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 -> 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
@62mkv
62mkv / find-class-in-jar
Last active May 13, 2019 07:31
Find class in a set of JAR files
sudo find /path/to/ -name "*.jar" -exec sh -c 'jar -tf {}| grep -H --label {} package' \;
@62mkv
62mkv / oracle.md
Last active February 4, 2020 11:01
Oracle cheatsheet
  • Show table DDL:
    select dbms_metadata.get_ddl('TABLE', '<your table name>') from dual

  • List all of the (available) tables: select * from user_tables