Rahul Kumar

rahulkumar@mymac ~ $ cat .bash_profileexport PATH=${PATH}:/usr/local/mysql/bin/# added by Anaconda3 5.2.0 installerexport PATH="/anaconda3/bin:$PATH"
# added maven pathexport M2_HOME=$HOME/Applications/apache-maven-3.6.2export PATH=$PATH:$M2_HOME/bin
# Git branch in prompt.parse_git_branch() {git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
JAVA_HOME= /Library/Java/JavaVirtualMachines/jdk1.8.jdk/Contents/Home/export JAVA_HOME;export PATH="$PATH:/Users/rahulkumar/Desktop/flutter_setup/flutter/bin"

--

--

1. curl: (60) SSL certificate problem: certificate has expiredMore details here: https://curl.haxx.se/docs/sslcerts.html

— — — — — — — — — — — — — — — — — — — — — — — — — — — — -

--

--

<?xml version="1.0" encoding="UTF-8"?> <build>   <plugins>     <plugin>       <artifactId>maven-resources-plugin</artifactId>       <executions>         <execution>           <id>copy-resources</id>           <phase>validate</phase>           <goals>             <goal>copy-resources</goal>           </goals>           <configuration>             <outputDirectory>${basedir}/target/classes/static/</outputDirectory>             <resources>               <resource>                 <directory>${basedir}/kaliber-webapp/dist/kaliber-webapp</directory>               </resource>             </resources>           </configuration>         </execution>       </executions>     </plugin>     <plugin>       <groupId>org.springframework.boot</groupId>       <artifactId>spring-boot-maven-plugin</artifactId>     </plugin>     <plugin>       <groupId>org.apache.maven.plugins</groupId>       <artifactId>maven-pmd-plugin</artifactId>       <version>3.11.0</version>       <configuration>         <targetJdk>1.8</targetJdk>         <!-- <rulesets> <ruleset>${basedir}/pmd-ruleset.xml</ruleset> </rulesets> -->         <printFailingErrors>true</printFailingErrors>       </configuration>       <executions>         <execution>           <goals>             <goal>check</goal>             <goal>cpd-check</goal>           </goals>         </execution>       </executions>     </plugin>   </plugins>   <finalName>kaliber-webapplication</finalName> </build>

--

--

mongo.yml file configuration:-

version: '3'
services:

mongodb:
image: mongo:latest
restart: on-failure
volumes:
- $HOME/Documents/udaanDb:/data/db
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
ports:
- 27017:27017

Now run the mongo.yml file. To run the file:

docker-compose -f <file-location> up -d

# Now check for the mongo dependency in pom.xml file. If the below dependency is not there add it.

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
  • That’s all in dependency for now. Let’s configure the application-properties file now.
server.port = 8080
spring.data.mongodb.uri=mongodb://root:example@0.0.0.0:27017/?authSource=admin&authMechanism=SCRAM-SHA-1
spring.data.mongodb.database=udaanUserDb

--

--

  1. delete multiple containers at:
docker containers ls --all
docker container rm <container-id1> <container-id2> ..

2. delete docker image:

- docker images
- docker rmi <image-tag>

3. mongo.yml file:

version: '3'
services:
mongodb:
image: mongo:latest
restart: on-failure
volumes:
- $HOME/Documents/kaliberDb:/data/db
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
ports:
- 27017:27017
  • > To run the mongo.yml file:
docker-compose -f <file-location> up -d

--

--

Example: Angular Project

  1. To create a new angular project:- ng new <project_name>
  2. go to that directory
  3. Now to push the code on GitLab:
    -> git add .
    -> git commit -m “put your message here”
    -> git push — set-upstream git@gitlab.com:<gitlabUserName>/<projectName.git> master

--

--

import json
import os from elasticsearch import Elasticsearch
es = Elasticsearch('https://your-url.com')
es_index_name = os.getenv('ES_INDEX_NAME', 'index-name')
if __name__ == '__main__':
with open('jsonFilePath.json') as f:
data = json.load(f)
for d in data:
print(d)
es.index(es_index_name, body=d)

Upload data to ES Index after typecasting into an object:

import json# import os from elasticsearch import Elasticsearch# es = Elasticsearch('https://url.com')# es_index_name = os.getenv('ES_INDEX_NAME', 'index-name')if __name__ == '__main__':with open('sample-json.json') as f:data = json.load(f)for d in data:print('\n')if(d.get("heatmap")):x = {"heatmap": d.get("heatmap"),"dwell-time": d.get("dwell-time"),"cameraSlug": d.get("cameraId"),"storeSlug": d.get("store"),"timeStamp": d.get("timeStamp"),"solutionSlug": d.get("solutionSlug"),"objectName": d.get("objectName")}print("data" , x)print('\n')# es.index(es_index_name, body=d)

--

--

  1. Delete between timeStamp range
curl -XPOST "https://domain-url/index-name/_delete_by_query?pretty" -H 'Content-Type: application/json'  -d '
{
"query": {
"range" : {
"timeStamp" : {
"gte" : 1617820217000,
"lte" : 1617858017000
}
}
}
}'

2. Delete between timeStamp range and with a match query on cameraId:

curl -XPOST "https://domain-url/index-name/_delete_by_query?pretty" -H 'Content-Type: application/json'  -d '{"query":{"bool":{"must":[{"range":{"timeStamp":{"gte":1621276200000,"lte":1621323000000}}},{"match":{"cameraId":"camera-name"}}]}}}'

3.

curl -XPOST "https://domain-url/index-name/_delete_by_query?pretty" -H 'Content-Type: application/json'  -d '
{
"query": {
"bool": {
"must": [
{
"range": {
"timeStamp": {
"gte": 1621276200000,
"lte": 1621323000000
}
}
},
{
"match": {
"cameraId": "camera-name"
}
}
]
}
}
}

--

--