Skip to content

Instantly share code, notes, and snippets.

View nachiket-lab's full-sized avatar
😀
Cropped

Nachiket nachiket-lab

😀
Cropped
View GitHub Profile
@nachiket-lab
nachiket-lab / kibana.yaml
Created March 24, 2022 14:44
Kibana ECK Deployment
apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
namespace: dev
name: nachiket
spec:
version: 7.17.1
count: 1
elasticsearchRef:
name: nachiket
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: nachiket
namespace: dev
spec:
version: 7.17.1
nodeSets:
- name: controlplane
count: 3
@nachiket-lab
nachiket-lab / Bucket Aggregations
Created May 10, 2021 04:31
Elasticsearch bucket aggregations
# Bucket Selector Query
Suppose we need to find a scenario where multiple users are logging in from a single source IP. We would write a query to do the following:
1. Query and filter the event id you need
2. Aggregate the results by ip addresses
3. Aggregate the output of ip addresses by the users
4. Select only the buckets that cross our threshold (In our case 10)
We could easily write a query to do this in dev_tools as follows:
```
import collections.abc
import yaml
# Flatten the yaml dictionary into a set of strings
# https://stackoverflow.com/a/6027615/10922298
def flatten(d, parent_key='', sep='.'):
items = []
for k, v in d.items():
new_key = parent_key + sep + k if parent_key else k
if isinstance(v, collections.MutableMapping):
@nachiket-lab
nachiket-lab / settings.py
Created June 2, 2020 06:43 — forked from ipmb/settings.py
Django logging example
import logging.config
import os
from django.utils.log import DEFAULT_LOGGING
# Disable Django's logging setup
LOGGING_CONFIG = None
LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper()
logging.config.dictConfig({
@nachiket-lab
nachiket-lab / readme.md
Created May 13, 2019 11:25
Jupyter Lab Kernel

Clone the base env

$ conda create --name --clone base

Create a kernel

$ ipython kernel install --name --user

Install packages

export http_proxy="xyz" export https_proxy="xyz"

Within infinite myths lies the eternal truth
Who sees it all?
Varuna has but a thousand eyes,
Indra has a hundred,
You and I, only two.

  • Devdutt Pattanaik

Normal Text

Some Links:
Link 3