Skip to content

Instantly share code, notes, and snippets.

View romanoffs's full-sized avatar
🎯
Focusing

Денис romanoffs

🎯
Focusing
View GitHub Profile
@romanoffs
romanoffs / CustomStack.java
Last active September 16, 2020 13:22
Stack Data Structure in Java | push, put -> 0(1)
public class CustomStack {
private int size;
private final int[] arr;
public CustomStack(int maxSize) {
this.arr = new int[maxSize];
this.size = -1;
}
@romanoffs
romanoffs / RedisTokenRepositoryImpl.java
Last active July 28, 2020 10:55
Implement for Spring Security Remember Me Redis repository
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.lang.Nullable;
import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken;
@romanoffs
romanoffs / mixin.styl
Last active May 19, 2020 15:57
My Mixins for stylus
sm-size = 575.98px
md-size = 767.98px
lg-size = 991.98px
xl-size = 1199.98px
first = 'max'
sm()
@media ({first}-width: sm-size)
{block}
@romanoffs
romanoffs / js.js
Created May 18, 2020 15:55
16:9 aspect ratio calculation
const calculatorResolution = width => Math.round((width / 16) * 9);
@romanoffs
romanoffs / number.txt
Last active April 13, 2020 15:19
Ukrainian number Regex
(\+380)+\d{9}$
@romanoffs
romanoffs / cloudflare.conf
Created December 23, 2019 12:42
Nginx Proxy for CloudFlare
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
#include <sys/types.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#define BUF_SIZE 4096
#define OUTPUT_MODE 0700
#define TRUE 1
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#define NUMBER_OF_THREADS 10
void *print_hello_world(void *tid) {
printf("Hello World This Thread is : %d\n", tid);
pthread_exit(NULL);
public static int diagonalDifference(int size, List<List<Integer>> arr) {
int sum1, sum2;
sum1 = IntStream
.range(0, size)
.map(i -> arr.get(i).get(i))
.sum();
sum2 = IntStream
.range(0, size)
@romanoffs
romanoffs / docker
Created November 27, 2019 16:17
check Health Check Erros
docker inspect --format "{{json .State.Health }}" 6c50d06ba424 | jq