Skip to content

Instantly share code, notes, and snippets.

@2e3s
2e3s / gist:9cab65985d932a060704
Last active August 29, 2015 14:11
Elasticsearch histogram can start only from divisible by interval value
# Remove old data
curl -XDELETE "http://localhost:9200/divisible"
# Create Document
curl -XPOST "http://localhost:9200/_bulk" -d '
{"create": {"_index": "divisible", "_type": "divisible"}}
{"value": 1}
{"create": {"_index": "divisible", "_type": "divisible"}}
{"value": 2}
{"create": {"_index": "divisible", "_type": "divisible"}}
{"value": 3}
# Remove old data
curl -XDELETE "http://localhost:9200/multisort"
# Create Document
curl -XPOST "http://localhost:9200/_bulk" -d '
{"create": {"_index": "multisort", "_type": "multisort"}}
{"value": 1, "group": 1, "sum": 10}
{"create": {"_index": "multisort", "_type": "multisort"}}
{"value": 2, "group": 1, "sum": 10}
{"create": {"_index": "multisort", "_type": "multisort"}}
{"value": 3, "group": 2, "sum": 1}
@2e3s
2e3s / es_custom_fields.sh
Last active January 29, 2020 17:24
Custom Fields By Elasticsearch
#!/bin/sh
echo "Create index: "
# 64-bit long (-2^63..2^63-1) and double values are used
# all fields can take arrays as well but it's not possible to mix the types
curl -XPOST localhost:9200/transaction_temp -d '{
"mappings" : {
"live" : {
"_source" : { "enabled" : true },
"dynamic" : false,
@2e3s
2e3s / veracrypt_find_by_mask.py
Last active November 3, 2017 03:06
Recover partially forgotten password for Truecrypt/Veracrypt container
"""
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
@2e3s
2e3s / README.md
Last active April 2, 2024 11:58
Pomodoro in KDE

I use a great widget focus-plasmoid (KDE store) for Pomodoro-driven work on KDE. There are no prominent alternatives so far.

The work happens on a different virtual desktop (or activity).

  • When focus starts, the virtual desktop with working applications gets switched on.
  • When focus ends, a message box asks for a short description of what is done in the past period (when it is still in the context), then a daily report is shown as a popup and the virtual desktop gets changed.
  • A few seconds of the sleep time is to avoid confusion and prepare to get switched after a dong sound.
  • The report gets also saved in a folder along the script for every day and can be reviewed later.