Skip to content

Instantly share code, notes, and snippets.

View projected1's full-sized avatar
๐Ÿ˜Ž
Coding

Daniel Gorbatov projected1

๐Ÿ˜Ž
Coding
View GitHub Profile
@projected1
projected1 / intellij-shortcuts.md
Created April 22, 2021 06:43
Keyboard shortcuts for IntelliJ.

IntelliJ Keyboard Shortcuts

Command Description
Shift x2 Search anywhere
Ctrl x2 Run anything
Ctrl N Open any class
Ctrl Shift N Open any file
Alt F7 Find references
Alt J Quick search and replace
@projected1
projected1 / spring-transactions.md
Created March 2, 2021 23:33
Transactions management and configuration in the Spring framework.

Spring Transactions

JTA (Java Transaction API) Transaction Management

Transaction synchronization is the process by which a persistence context is registered with a transaction so that the persistence context can be notified when a transaction commits. The provider uses this notification to ensure that a given persistence context is correctly flushed to the database.

Transaction association is the act of binding a persistence context to a transaction. You can also think of this as the

@projected1
projected1 / formatException.java
Created February 2, 2021 12:21
Unwinds Java exception stack and converts it to a formatted string.
/**
* Unwinds Java exception stack and converts it to a formatted string.
*
* e.g.
*
* Exception in thread "main"
* java.lang.RuntimeException: java.lang.RuntimeException: test
* at com.example.Main.foo(Main.java:50)
* at com.example.Main.test(Main.java:40)
* at com.example.Main.main(Main.java:14)
@projected1
projected1 / java-version-switch.bat
Created January 19, 2021 14:26
Switches between installed Java versions.
@echo off
setlocal
rem Must run elevated
net session > nul 2>&1
if not %errorLevel% == 0 (
echo Error: Please re-run as admin
goto end
)
@projected1
projected1 / nexus-mvn-deploy.bat
Created January 18, 2021 12:56
Deployes artifacts to Sonatype Nexus using Maven.
@rem ------------------------------------------------------
@rem Usage:
@rem nexus_mvn_deploy.bat <groupId> <artifactId> <version> <path/to/file> <path/to/maven_settings>
@rem
@rem ------------------------------------------------------
@echo off
setlocal
if "%1" == "" (
@projected1
projected1 / mvn.bat
Created January 18, 2021 12:45
Wrapper script for Maven CLI to simplify builds.
@rem ------------------------------------------------------
@rem Usage:
@rem mvn.bat <phase_or_goal> <list_of_modules> <path/to/settings.xml>
@rem
@rem phase_or_goal - compile, package, test
@rem list_of_modules - Comma-delimited list of modules in a multi-module project:
@rem "module_name_to_include,!module_name_to_exclude"
@rem
@rem Example:
@rem mvn.bat package "main-module,!deprecated-module" "%homepath%\.m2\settings.xml"
@projected1
projected1 / oc-cli.md
Last active February 22, 2021 08:47
OpenShift CLI - Commands Reference

oc-cli

Login & Select Project

$ oc login --token=<your_token> --server=<ocp_host>
$ oc projects
$ oc project <project_name>

Manage PODs

@projected1
projected1 / spring-microservices-resources.md
Last active January 18, 2021 15:48
Learning resources for Java/Spring microservices, Elasticsearch, Couchbase, Kafka & K8S.
@projected1
projected1 / binary-tree-traversal.cpp
Created October 16, 2020 08:37
Binary tree traversal - C++ 17 implementation.
#include <map>
#include <array>
#include <string>
#include <vector>
#include <memory>
#include <sstream>
#include <cassert>
#include <iostream>
#include <exception>
@projected1
projected1 / decompile-jar.bat
Last active October 6, 2020 09:19
Decompiles Java JAR files.
@rem ------------------------------------------------------
@rem Decompiles Java JAR files.
@rem This script depends on the following libraries:
@rem * 7ZIP CLI : https://www.7-zip.org/a/7z1900-extra.7z
@rem * jad decompiler: http://www.kpdus.com/jad/winnt/jadnt158.zip
@rem ------------------------------------------------------
@echo off
setlocal