Skip to content

Instantly share code, notes, and snippets.

Batuhan Bayrakci baybatu

Block or report user

Report or block baybatu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@baybatu
baybatu / rabbitmq-delay-message-consume.md
Last active Jan 18, 2019
RabbitMQ: mesajı geciktirerek tüketmek
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
@baybatu
baybatu / es-delete-indices-by-wildcard.sh
Created Dec 28, 2018
Delete indices by wildcard pattern in Elasticsearch #elasticsearch
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
@baybatu
baybatu / ThreadPoolTaskExecutorWithMdcPropagation.java
Last active Dec 20, 2018
Propogate MDC context into newly created thread pool
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();
}
@baybatu
baybatu / json-format-using-vim-with-python.md
Last active Feb 8, 2019
JSON format in Vim using Python json.tool module
View json-format-using-vim-with-python.md
@baybatu
baybatu / datagrip-database-connections.md
Last active Nov 6, 2018
Import & Export database connection properties in DataGrip
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

@baybatu
baybatu / pip-install-by-specific-python.sh
Created Oct 16, 2018
Install pip package for specified Python version
View pip-install-by-specific-python.sh
pyenv shell 3.6.4 # Shell specific Python version
/usr/local/var/pyenv/versions/3.6.4/bin/python -m pip install -U PACKAGE_NAME
@baybatu
baybatu / realtime-tracking-stdout-line-count.sh
Last active Oct 11, 2018
Tracking line count of a docker container's stdout in realtime
View realtime-tracking-stdout-line-count.sh
docker logs -f --since 2s $(docker ps -qa --filter "name=CONTAINER_NAME") | pv -l -c > /dev/null
@baybatu
baybatu / last-records-on-elasticsearch.sh
Created Sep 14, 2018
Get records indexed in last 15 minutes on Elasticsearch
View last-records-on-elasticsearch.sh
curl -XGET "http://ES_CLUSTER/_search" -H 'Content-Type: application/json' -d'
{
"query": {
"range" : {
"@timestamp" : {
"gte" : "now-15m",
"lt" : "now"
}
}
}
@baybatu
baybatu / macos-mail-gmail-mail-complete.md
Created Sep 13, 2018
macOS'da Mail uygulamasının Gmail'deki e-posta adreslerinin tamamlamaması sorunu çözümü
View macos-mail-gmail-mail-complete.md
  • Address Book uygulamasında Preferences > Account sekmesinde Google hesabını etkinleştir.
  • Uygulamanın sunucuyla senkronize olmasını bekle.
  • Mail uygulamasını kapat aç.
@baybatu
baybatu / delete-by-query.json
Created Sep 4, 2018
Delete documents by query in Elasticsearch
View delete-by-query.json
POST INDEX_NAME/_delete_by_query
{
"query": {
"bool": {
"must": [
{
"term": {
"field1": "100"
}
},
You can’t perform that action at this time.