Skip to content

Instantly share code, notes, and snippets.

View gavvvr's full-sized avatar
🥷
Taming complexity

Kirill Gavrilov gavvvr

🥷
Taming complexity
View GitHub Profile
@gavvvr
gavvvr / install-jenkins-on-mac.md
Last active September 24, 2023 13:37
Local Jenkins CI for mac
  1. brew install --ignore-dependencies jenkins-lts (The reson I use --ignore-dependencies is because I do not want JDK brought by brew, because I manage JDKs with SDKMAN. brew says --ignore-dependencies is deprecated, but it still does it's job)
  2. adjust location of java binary at ProgramArguments section in homebrew.mxcl.jenkins-lts.plist located at:
    • /usr/local/opt/jenkins-lts/homebrew.mxcl.jenkins-lts.plist for Intel-based Macs
    • /opt/homebrew/opt/jenkins-lts/homebrew.mxcl.jenkins-lts.plist for Apple Silicon
  3. brew services start jenkins-lts
  4. open http://localhost:8080/
  5. look up the initial password at ~/.jenkins/secrets/initialAdminPassword

Optionally: run JVM with -Dhudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT=true, if you simply work locally and clone using file:// protocol

@gavvvr
gavvvr / download-all-obsidian-plugins.js
Created May 7, 2023 21:48
Download source codes of all obsidian community plugins
const https = require('https')
const { spawn } = require('child_process')
const url =
'https://raw.githubusercontent.com/obsidianmd/obsidian-releases/master/community-plugins.json'
https.get(url, (res) => {
let data = []
res.on('data', (chunk) => {
data.push(chunk)
@gavvvr
gavvvr / jUnit-xml-test-reports-aggregation.gradle.kts
Last active January 1, 2023 13:30
Gradle task to collect all jUnit XML test reports from all submodules
// The Gradle's test-report-aggregation collects only html reports in a single place and ignores XML reports
// Here is the custom task to collect all jUnit xml reports in a single place
tasks.register<Copy>("testCollectjUnitXmlReports") {
val allTestTasks = rootProject
.subprojects
.flatMap { it.tasks.withType<Test>() }
val allJunitXmlLocations = allTestTasks
.map { it.reports.junitXml.outputLocation.asFile.get() }
from(*allJunitXmlLocations.toTypedArray())
into(rootProject.layout.buildDirectory.dir("test-results/test"))
@gavvvr
gavvvr / .README.md
Last active December 16, 2022 06:14
Migrate UUID values from legacy binary type 3 to standard

MongoDB migration: From legacy UUID represenation (binary type 3) to standard (type 4)

You may face the need to migrate your data, because legacy format was a default choice for a long time in Spring Boot/Data MongoDB and the official MongoDB driver itself (more details here).

So, here is the Java solution based on utilitites from Mongo's org.bson:bson to perform the migration.

@gavvvr
gavvvr / README.md
Created July 8, 2022 19:26
Enabling mongo transactions using docker-compose

If you develop against of containerized mongo instance using the official Docker Mongo image and make attempt to use transactions, you will most probably face the following error:

com.mongodb.MongoCommandException: Command failed with error 20 (IllegalOperation): 'Transaction numbers are only allowed on a replica set member or mongos' on server localhost:28017. The full response is {"ok": 0.0, "errmsg": "Transaction numbers are only allowed on a replica set member or mongos", "code": 20, "codeName": "IllegalOperation"}

This single docker-compose.yaml will solve the problem by creating replica set out of single node.

@gavvvr
gavvvr / analyze.sh
Created December 12, 2021 17:00
Quickly run dockerized SonarQube
docker run --rm \
--network host \
-e SONAR_HOST_URL="http://localhost:9000" \
-e SONAR_LOGIN=$SONAR_LOGIN \
-v $HOME/.sonar/cache:/opt/sonar-scanner/.sonar/cache \
-v `pwd`:/usr/src \
sonarsource/sonar-scanner-cli:4
@gavvvr
gavvvr / Installation.md
Last active January 7, 2024 02:09
Using SDKMAN! with git for Windows shell (git bash)

Using SDKMAN! with git for Windows shell (git bash)

Prerequisite

If you are a software developer, most probably you already have both components already installed:

Installing SDKMAN! to your git bash

@gavvvr
gavvvr / gradle.properties
Created July 30, 2021 08:01
Forcing Gradle to work only with custom local repository
artifactoryUrl=https://your.repo/artifactory
@gavvvr
gavvvr / dockerized-oracle-11-xe.md
Last active August 4, 2021 08:40
Get dockerized Oracle 11 XE easily

Get dockerized Oracle 11 XE database easily

  • Clone official dockerfiles:
git clone https://github.com/oracle/docker-images oracle-docker-images
cd oracle-docker-images/OracleDatabase/SingleInstance/dockerfiles
@gavvvr
gavvvr / Jenkinsfile
Last active November 20, 2023 12:00
Simple text file templates using Jenkins pipeline
// Just an example, for Rails config better use embedded ERB
final DATABASE_YAML_TEMPLATE = '''
test:
adapter: oracle_enhanced
database: app_db
username: ${user}
password: ${password}
'''
final CFG_PATH = 'config/database.yml'