Skip to content

Instantly share code, notes, and snippets.

View steklopod's full-sized avatar
🎯
spot on

Dima Kaltovich steklopod

🎯
spot on
  • Berlin, Germany
View GitHub Profile
@steklopod
steklopod / VPS_hosting.md
Last active April 18, 2024 19:26
COLAB ssh commands

Prepare

  • apt update
  • apt-get update
  • apt upgrade
  • apt-get upgrade
  • apt-get install unzip zip bash apt-transport-https ca-certificates nano curl gnupg-agent software-properties-common gcc g++ make htop git

Oh My Zsh - terminal

@steklopod
steklopod / WebTestClient.kt
Created December 19, 2018 10:43
Example of junit 5 WebTestClient on Kotlin
import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.extension.ExtendWith
package com.javarush.task.task31.task3102;
import java.io.File;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.*;
/*
Находим все файлы
@steklopod
steklopod / Cron.java
Created August 2, 2020 13:11
Spring boot cron
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@NoArgsConstructor
@steklopod
steklopod / AbstractMapper.java
Created August 2, 2020 13:08
Map Struct util class
import java.util.List;
import java.util.UUID;
public interface AbstractMapper<T, R> {
R map(T source);
List<R> map(List<T> sourceList);
default UUID stringToUUID(String string) {
@Data
@Validated
@ConfigurationProperties("registration.kafka")
public class KafkaProperties {
@NotEmpty(message = "Parameter 'bootstrap-servers' can not be empty")
private String bootstrapServers;
@NestedConfigurationProperty
@NotNull(message = "Parameter 'some-activate' can not be null")
version: "3.7"
# docker-compose up --d --build --force-recreate redis
services:
redis:
image: redis:alpine
container_name: redis
hostname: redis
command: redis-server --requirepass 123456
restart: unless-stopped
select h.id as hacker_id, name, sum(m_score) as total_score from(
  select h.id, h.name, nvl(max(s.score),0) m_score from hackers h
    left join submissions s on
       s.hacker_id=h.id
    group by h.id, s.challenge_id
)
where m_score > 0
order by total_score desc, name asc;
@steklopod
steklopod / Kafka.md
Last active February 4, 2020 08:45
Kafka

Start

Windows

  • zookeeper-server-start.bat config/zookeeper.properties
  • kafka-server-start.bat config/server.properties

Create

kafka-topics.bat --bootstrap-server localhost:9092 --topic first --create --partitions 6 --replication-factor 1

List

kafka-topics.bat --bootstrap-server localhost:9092 --list

Delete

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
// Написать функцию, которая получает на вход массив и искомое число и возвращает 2 элемента в массиве, которые в сумме дадут это число (за n^2 решать не надо).