Skip to content

Instantly share code, notes, and snippets.

View naviat's full-sized avatar
🪲

naviat

🪲
View GitHub Profile
@naviat
naviat / gist:7cf3f136f8e96b5de0961a95e6ebc38c
Created July 21, 2022 08:46 — forked from exAspArk/gist:c325bb9a75dcda5c8212
Elasticsearch: calculating user sessions with Map/Reduce (Ruby)
# The same algorithm which is used in Google Analytics (https://support.google.com/analytics/answer/2731565?hl=en):
# Time-based expiry (including end of day):
# - After 30 minutes of inactivity
# - At midnight
# Enable dynamic scripting for Groovy (https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#_enabling_dynamic_scripting)
# ! WARNING: please read about security first
# Usage:
#
# Maintainer: Jakub Hajek, jakub.hajek@cometari.com
#
# docker stack deploy -c stack-elastic.yml elastic
#
# The stack creates Elasticsearch cluster consiting of
# - 3 dedicated master nodes in order to keep quorum
# - 4 dedicated data nodes to manage CRUD,
#
# Docker compose file to easily deploy Elasticsearch cluster 7.x on Docker Swarm cluster.
@naviat
naviat / tmux-cheatsheet.markdown
Created March 17, 2021 10:45 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

Mastering your history

Frequently rebasing from master

If you work on feature branches, like we do, that are based off a parent branch (e.g. the master branch of the main repository), you want to avoid your branch getting out of sync with the latest work in the parent branch.

As time goes by, your forked branch where you’re working can become significantly out of sync with the latest master branch. This may mean that merging your work

@naviat
naviat / LocalDot.md
Last active January 15, 2024 19:53
Dotfile for zsh

Step by step

For AWS CLI ALIAS

  • Install aws cli
  • Copy file alias to ~/.aws/cli/ and use the alias: aws
git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt"
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
@naviat
naviat / helm-cheatsheet.md
Last active March 10, 2020 03:39 — forked from tuannvm/cka.md
#Helm #Kubernetes #cheatsheet, happy helming!
@naviat
naviat / git_emoji.md
Created September 11, 2019 08:54
Git emoji list

The list

Text Image Shortcode When to use it
🎉 🎉 :tada: initial commit
:sparkles: when adding a new user-facing feature
🎨 🎨 :art: when improving UI
📦 📦 :package: when refactoring or improving code
🐎 🐎 :racehorse: when improving performance
🔒 🔒 :lock: when improving security
@naviat
naviat / install.sh
Last active July 23, 2019 07:15
Script install Docker - docker compose on Ubuntu
#!/bin/bash
#Author Hai Dam <haidv@tomochain.com>
export DOCKER_COMPOSE_VERSION="1.24.0"
set -eu
function echocolor {
echo "$(tput setaf 2) $1 $(tput sgr0)"
}
@naviat
naviat / add-to-sudoers.sh
Created August 1, 2018 16:43 — forked from gildas/add-to-sudoers.sh
Add the current user to the sudoers
#!/bin/sh
if [ -z "$1" ] ; then userid=$(whoami); else userid=$1; fi
sudo tee /etc/sudoers.d/${userid} > /dev/null <<EOF
${userid} ALL=(root) NOPASSWD:ALL
EOF