Instantly share code, notes, and snippets.

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

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
View realtime-tracking-stdout-line-count.sh
docker logs -f --since 2s $(docker ps -qa --filter "name=CONTAINER_NAME") | pv -l -c > /dev/null
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"
}
}
}
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ç.
View delete-by-query.json
POST INDEX_NAME/_delete_by_query
{
"query": {
"bool": {
"must": [
{
"term": {
"field1": "100"
}
},
View disable-vino-encryption.sh
gsettings set org.gnome.Vino require-encryption false