This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install ubuntu-desktop | |
sudo apt-get install ubuntu-desktop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set python3 as a default python on Ubuntu | |
# type | |
sudo gedit .bash_aliases | |
# then write the following to file | |
alias python=python3 | |
or | |
alias python='/usr/bin/python3' | |
# close current terminal and open new one |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## inspect container | |
docker container inspect <container_name> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
// create client | |
ElasticsearchClient client = new ElasticsearchClient(); | |
String startDateStr = "2018-10-01T00:00:00.000Z"; | |
String endDateStr = "2019-03-15T00:00:00.000Z"; | |
QueryBuilder query = QueryBuilders.matchQuery(<key>, <Id>); | |
SearchRequestBuilder searchBuilder = client.prepareSearch(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File consists of json objects | |
FileInputStream inputStream = null; | |
Scanner sc = null; | |
try { | |
inputStream = new FileInputStream(file_path); | |
sc = new Scanner(inputStream, "UTF-8"); | |
while (sc.hasNextLine()) { | |
String line = sc.nextLine(); | |
JsonObject json = new JsonParser().parse(line).getAsJsonObject(); | |
//... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run script on the background | |
nohup script.sh & | |
# run script on the background and logs to a file | |
nohup script.sh > filename & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> list indices | |
curl -X GET "localhost:9200/_cat/indices?v" | |
>> show elasticsearch health | |
curl -s -X GET 'http://localhost:9200/_cluster/health/' | |
>> delete index | |
curl -XDELETE http://localhost:9200/index_name/ | |
>> ask document count |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.SimpleDateFormat; | |
import java.util.Calendar; | |
import java.util.Date; | |
import java.util.TimeZone; | |
String strDate = "2019-04-01T00:00"; | |
// create format | |
SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"); | |
DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from elasticsearch import Elasticsearch | |
es = Elasticsearch([{'host': "localhost", 'port': 9200}]) | |
query = { | |
"sort": [ | |
{"timestamp": {"order": "asc"}}, | |
{"_score": {"order": "asc"}} | |
], | |
"query": {"bool": {"must": [{"match": {"id": id}}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from elasticsearch import Elasticsearch | |
from elasticsearch import helpers | |
start_time = "Some Date" | |
end_time = "Some Date" | |
parameter = "" | |
query = {"query": {"bool": | |
{"must": [ | |
{"match": {"parameter": parameter}}, | |
{"range": {"timestamp": {"gte": start_time, "lte": end_time}}} |
NewerOlder