Instantly share code, notes, and snippets.

Batuhan Bayrakci baybatu

View GitHub Profile
View liquibase-changelog.sh
java -jar liquibase.jar \
--driver=org.postgresql.Driver \
--classpath=postgresql-9.4.1208.jre6.jar \
--changeLogFile=/workspace/product-api/src/main/resources/db/changelog.xml \
--url="jdbc:postgresql://localhost:5432/product" \
--username=root \
--password=123qwe \
updateSQL
View ReIndexJenkinsfile
#!/usr/bin/env groovy
node {
stage('checkout') {
checkout scm
}
stage("Reindex") {
String esHost = params.esHost //example: localhost:9200
String oldIndexVersion = params.oldIndexVersion //example: v1
String newIndexVersion = params.newIndexVersion //example: v2
View SwitchAliasJenkinsfile
#!/usr/bin/env groovy
node {
stage('checkout') {
checkout scm
}
stage("Switch alias between index versions") {
String esHost = params.esHost //example: localhost:9200
String oldIndexVersion = params.oldIndexVersion //example: v1
String newIndexVersion = params.newIndexVersion //example: v2
View PaginationThroughHttpHeadersResponseAdvice.java
@ControllerAdvice
public class PageResponseAdvice implements ResponseBodyAdvice<Object> {
@Override
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
return PageResponse.class.isAssignableFrom(returnType.getParameterType());
}
@Override
public Object beforeBodyWrite(Object body,
View rabbitmq-delay-message-consume.md

RabbitMQ: Mesajı Geciktirerek Tüketmek

  • delay-exchange: Geciktirilecek mesajın bırakıldığı exchange.
  • delay-queue: delay-exchange'e bağlı. Herhangi bir tüketicisi olmamalı.
  • ana-exchange: Geciktirilmeden tüketilmek istenen mesajların bırakılabileceği exchange.
  • ana-queue: ana-exchange'e bağlı kuyruk. Tüketicisi var.

delay-queue şu parametrelerle oluşturulur:

  • x-dead-letter-exchange: -- boş
  • x-message-ttl: 3000 -- mesajın bekletileceği milisaniye
View es-delete-indices-by-wildcard.sh
for index_name in `curl -XGET "$ES_HOST/products_*" | jq -r 'keys[]'`; do
curl -XDELETE "$ES_HOST/$index_name"
done
View ThreadPoolTaskExecutorWithMdcPropagation.java
public class ThreadPoolTaskExecutorWithMdcPropagation extends ThreadPoolExecutor {
private static final Logger LOGGER = LoggerFactory.getLogger(ThreadPoolTaskExecutorWithMdcPropagation.class);
private final Map<String, String> parentMdcContextMap;
public ThreadPoolTaskExecutorWithMdcPropagation(int corePoolSize, int maxPoolSize, long keepAliveTime, TimeUnit keepAliveTimeUnit) {
super(corePoolSize, maxPoolSize, keepAliveTime, keepAliveTimeUnit, new LinkedBlockingQueue<>());
parentMdcContextMap = MDC.getCopyOfContextMap();
}
View json-format-using-vim-with-python.md
View datagrip-database-connections.md

on macOS

default folder in /Users/USERNAME/Library/Preferences/DataGrip2018.1/projects contains database connection properties.

DataGrip2018.1 states your DataGrip version