Skip to content

Instantly share code, notes, and snippets.

View cinhtau's full-sized avatar

Tan-Vinh Nguyen cinhtau

View GitHub Profile
@cinhtau
cinhtau / vote-626.md
Last active February 20, 2019 11:08
Voting Example

Data from vote 626

Remove type for ES 7.

POST _bulk
{"index":{"_index":"votes","_type":"doc","_id":"1"}}
{"canton":"Zürich","votes":{"yes":148438,"no":222301},"participation":40.2}
{"index":{"_index":"votes","_type":"doc","_id":"2"}}
{"canton":"Bern","votes":{"yes":96671,"no":179706},"participation":37.8}
@cinhtau
cinhtau / elasticsearch-s3-plugin.md
Last active November 14, 2019 12:20
Elasticsearch S3 Repository Quick Sheet

Installation

Step 1: Install Plugin

sudo bin/elasticsearch-plugin install repository-s3

Configuration

@cinhtau
cinhtau / 001-logstash-input.conf
Last active February 4, 2019 22:06
Fortune database Logstash Demonstration
input {
file {
path => "/home/vinh/development/projects/geek-fortune-cookies/databases/programming-wisdom"
sincedb_path => "/dev/null"
start_position => "beginning"
codec => multiline {
pattern => "^\%"
negate => true
what => "previous"
charset => "UTF-8"
@cinhtau
cinhtau / array-demo-improved.sh
Last active February 11, 2022 13:18
Working with Arrays in Linux Shell, bash and zsh, examples for https://blog.mimacom.com/arrays-on-linux-shell/
#!/usr/bin/zsh
echo "detecting shell:"
if [[ -n ${ZSH_VERSION} ]] && [[ ! -z ${ZSH_VERSION} ]]; then
INDEX_START=1
INDEX_OFFSET=0
echo " using zsh $ZSH_VERSION, index starts at $INDEX_START"
elif [[ -n $BASH_VERSION ]]; then
INDEX_START=0
INDEX_OFFSET=1
@cinhtau
cinhtau / docker-cheatsheet.md
Last active October 8, 2022 14:49
Docker Commands

View

Old way

docker ps

New consistent approach

# list containers
@cinhtau
cinhtau / filebeat.md
Last active November 13, 2018 16:07
2018-11-13 Elasticsearch Meet-up Stuttgart Demo 2 - Payments Statistics

Filebeat Checks

./filebeat test config
./filebeat test output
@cinhtau
cinhtau / 000_overview.md
Last active January 22, 2019 17:19
Demo Time
┌──Payments───────┐                     _._
│ ┌─────────────┐ │                _.-``__ ''-._
│ │  Terminal   │ │           _.-``    `.  `_.  ''-._
│ └─────────────┘ │       .-`` .-```.  ```\/    _.,_ ''-._
└────────┬────────┘      (    '      ,       .-`  | `,    )
         │               |`-._`-...-` __...-.``-._|'` _.-'|
         │               |    `-._   `._    /     _.-'    |
         ▼                `-._    `-._  `-./  _.-'    _.-'
┌─────────────────┐ |`-._`-._ `-.__.-' _.-'_.-'|
@cinhtau
cinhtau / find-examples.sh
Last active November 3, 2018 09:08
Some examples for find
# search for name
find . -name invoice.pdf
# search for name, not case sensitive
find . -iname sales.*
# list only subdirectories
find . -type d -maxdepth 1
# find and delete
@cinhtau
cinhtau / es-docker-cluster.yml
Last active August 26, 2018 09:03
docker-compose files for elastic stack
version: '2.2'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.0
container_name: elasticsearch
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits: