Skip to content

Instantly share code, notes, and snippets.

@ololx
ololx / clone.sh
Created October 25, 2023 07:19
This is an sh script for the cloning cassandra keyspace
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "Usage: $0 keyspace_from keyspace_to"
exit 1
fi
keyspace_from=$1
keyspace_to=$2
@ololx
ololx / grep.sh
Created October 5, 2023 08:25
This is an simple script for grep in txt files and zips
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "Usage: $0 [PATH_TO_FOLDER] [SEARCH_STRING]"
exit 1
fi
SRC_DIR="$1"
SEARCH_STRING="$2"
START_TIME=$SECONDS
@ololx
ololx / InjectUtils.java
Created June 22, 2022 09:29
Injecting objects in a static field - reflection hack; useful for testing, when you couldn't inject mock via constructor
package utils;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.function.Consumer;
public interface InjectUtils {
String MODIFIERS = "modifiers";
@ololx
ololx / java_download.sh
Created March 4, 2022 16:13 — forked from wavezhang/java_download.sh
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz
@ololx
ololx / 2.1 - Task 2
Last active January 15, 2022 08:48
Unitarius home tasks
# Задание 2
## Описание задания
Имеется массив A элементов (a(i)) длиной n.
Нужно переставить первые m элементов в конец массива.
После перестановки порядок следования элементов должен сохраниться.
Требуется предложить такой алгоритм перестановки элементов, чтобы общее количество действий K было пропорционально длине массива n, т.е., K = a*n, где a – некая константа.
В алгоритме можно пользоваться только простыми переменными (скалярными). Использование дополнительных вспомогательных массивов не допускается.
Число m – произвольное, т.е. куски {1, 2, .., m} и {m+1, m+2, .., n} массива имеют в общем случае разную длину.
@ololx
ololx / docker-compose.yml
Created October 3, 2021 14:24 — forked from onjin/docker-compose.yml
example docker compose for postgresql with db init script
postgres:
image: postgres:9.4
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
@ololx
ololx / FeignLogFiltering.java
Created July 14, 2021 09:44
This is a short code examples for realizing log tracing && log marking in Spring-Boot Applications
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;
import org.springframework.stereotype.Component;
/**
* @project some-api
* @created 2021-07-09 15:37
* <p>
@ololx
ololx / awesome-mac-os-trminal.md
Last active February 22, 2022 11:58
This is a quick walkthrough how to setup and configure iTerm2, Oh My Zsh! and Powerlevel10k on the mac os 10.12+

Awesome Terminal on macOS 10.12+

demo

This is a quick walkthrough how to setup and configure iTerm2, Oh My Zsh! and Powerlevel10k on the mac os 10.12+.

Prerequisites

  • macOS 10.12+
  • xCode tools
  • Homebrew
@ololx
ololx / Storing-Images-On-Github.md
Created March 16, 2021 12:43 — forked from joncardasis/Storing-Images-On-Github.md
Storing Images and Demos in your Repo

Storing Images and Demos in your Repo

In this quick walkthough you'll learn how to create a separate branch in your repo to house your screenshots and demo gifs for use in your master's readme.

How to

1. Clone a fresh copy of your repo

In order to prevent any loss of work it is best to clone the repo in a separate location to complete this task.

2. Create a new branch

Create a new branch in your repo by using git checkout --orphan assets