-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zsh_aliases
87 lines (71 loc) · 2.98 KB
/
.zsh_aliases
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# replace ls with exa
alias ls='exa'
alias ll='ls -lh'
alias la='ls -lha'
# always mk complete path
alias mkdir='mkdir -p'
# pretty top
alias top='htop'
alias dev='cd ~/Development'
# always use nvim
alias vim='nvim'
# directly edit neovim config
alias nvc='cd ~/.config/nvim && nvim'
alias grep='rg'
alias cat='bat'
alias lg='lazygit'
# always open in pager
alias glow='glow -p'
# power management
alias off='shutdown now'
alias restart='shutdown -r now'
# sql connections
alias mysql-local='mysql -uroot -ppassword -h127.0.0.1'
alias mysql-prod="gcloud beta sql connect operator-index --user=root --quiet"
# opens port to connect to cloud-sql at localhost:3307
alias mysql-prod-port-forward="~/Tools/cloud-sql-proxy/cloud-sql-proxy --address 0.0.0.0 --port 3307 aitastic-data:europe-west3:operator-index"
alias mysql-test-port-forward="~/Tools/cloud-sql-proxy/cloud-sql-proxy --address 0.0.0.0 --port 3308 aitastic-test-2:europe-west3:operator-index"
# development apps in docker
export DOCKER_APPS_DIR='/home/phil/Development/docker-configs'
alias docker-elastic="docker compose -f $DOCKER_APPS_DIR/elasticsearch-single-node-dev/docker-compose.yml"
alias docker-mysql="docker compose -f $DOCKER_APPS_DIR/mysql/docker-compose.yml"
alias docker-redis="docker compose -f $DOCKER_APPS_DIR/redis/docker-compose.yml"
# taskwarrior / timewarrior
alias todo='task'
alias tis='timew summary :id'
alias tisy='timew summary :id :yesterday'
alias tisw='timew summary :id :week'
alias tisl='timew summary :id :lastweek'
alias tism='timew summary :id :month'
# processor development
alias rundevproc='export KAFKA_PROCESSOR_CONFIG_PATH="config/config_dev.ini" && colorize_stderr poetry run python'
alias rundevmod='export KAFKA_PROCESSOR_CONFIG_PATH="config/config_dev.ini" && colorize_stderr poetry run python -m'
# workaround scripts media monitoring
alias similarweb="cd ~/Development/scripts-and-configs/workarounds/similar_web_metrics"
alias source-tracker="cd ~/Development/scripts-and-configs/workarounds/source-tracker"
##########################################
# FUNCTIONS #
##########################################
docker_ip() {
# prints out the IPAddress of the container with name $1, requires 1 positional argument
docker inspect $1 | jq '.[0].NetworkSettings.Networks' | grep 'IPAddress'
}
download_es_doc() {
# downloads a document from prod-Elasticsearch into a JSON-file based on it's ID
ID=$1
if [[ -z $ID ]]; then
echo "You need to set a ID! e.g. download_es_doc 42d1a1c7a2526959bf79c2439ef186a2e4753f1a203b1b7efa3b8f8b6b39e32f"
return 1
fi
http -a $ELASTICSEARCH_AUTH "https://es.aitastic.com/newsstand/_search?q=_id:$ID" | jq > $ID.json
}
colorize_stderr() {
# colorizes stderr-output of the following command in RED
# e.g. colorize_stderr $command
local RED="\033[0;31m"
local NO_COLOR="\033[0m" # Keine Farbe
"$@" 2> >(while read -r line; do
# Färben Sie stderr rot
echo -e "${RED}${line}${NO_COLOR}"
done)
}