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 / 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"
}
},
@baybatu
baybatu / disable-vino-encryption.sh
Created Aug 13, 2018
Disable vino encryption on Ubuntu
View disable-vino-encryption.sh
gsettings set org.gnome.Vino require-encryption false
@baybatu
baybatu / update-rows-using-subquery.sql
Last active Aug 9, 2018
Update rows using sub select query in PostgreSQL
View update-rows-using-subquery.sql
UPDATE cars
SET model = subNewCarsTable.newModelName
FROM (SELECT
nc.id AS carId,
nc.model AS newModelName
FROM new_cars nc
WHERE year=2018) subNewCarsTable
WHERE subNewCarsTable.carId = cars.id;
You can’t perform that action at this time.