dotfiles/.config/bash/gil_specific.sh

83 lines
3.7 KiB
Bash

export EDITOR=$HOME/.local/bin/nvim.appimage
export TERMINAL=st
export SHELL=/usr/bin/tmux
export PATH=$HOME/.local/bin:$PATH
alias vi="$EDITOR"
alias wakeup="wakeonlan -i 192.168.1.50 58:11:22:C9:D5:B9"
alias apt="sudo apt"
alias ya="yadm add"
alias yc="yadm commit -v"
alias yd="yadm diff"
alias ys="yadm status"
alias yup="yadm pull --rebase --autostash"
alias yp="yadm pull --rebase --autostash && yadm push"
alias sa="ssh-add"
alias todo="vi ~/Nextcloud/TODO/todo.txt"
alias sysup="sudo apt update && sudo apt upgrade -y"
alias g="./gradlew"
alias k="kubectl"
alias kns="kubens"
alias kctx="kubectx"
alias fluxUp="flux reconcile source git flux-system"
alias kprod="export AWS_PROFILE='production' && aws sso login && aws eks update-kubeconfig --region eu-west-1 --name rfidprod-production && kubens production && kubectl get po"
alias kstage="export AWS_PROFILE='staging' && aws sso login && aws eks update-kubeconfig --region eu-west-1 --name rfidprod-staging && kubens preprod && kubectl get po"
# Open a port forward session to a remote Kubernetes deployment
# @param {string} $1 Deployment name
# @param {number} $2 Local+remote OR local port number
# @param {number=} $3 Remote port number
kf() {
kubectl port-forward "$1" "$2${3:+:$3}"
}
# opensaml::FatalProfileException k exec -it ofbiz-front-d5f87f9bd-s2zc7 "/bin/bash"
ksh() {
kubectl exec -it "$1" "${2:+-c$2}" -- "/bin/bash"
}
alias tintMaison='ssh -A -L localhost:5488:localhost:5489 nereide@naxos.nereide.fr "ssh -p5422 -L localhost:5489:rfidprod-integration.cluster-cdb9sc2xntwg.eu-west-1.rds.amazonaws.com:5432 ofbiz@pp-sftp-technical.decathlon.net"'
alias tintBureau="ssh -v -p 5422 -L localhost:5488:rfidprod-integration.cluster-cdb9sc2xntwg.eu-west-1.rds.amazonaws.com:5432 ofbiz@pp-sftp-technical.decathlon.net"
alias tprepMaison='ssh -A -L localhost:5488:localhost:5489 nereide@naxos.nereide.fr "ssh -p5422 -L localhost:5489:rfidprod-preprod.cluster-cdb9sc2xntwg.eu-west-1.rds.amazonaws.com:5432 ofbiz@pp-sftp-technical.decathlon.net"'
alias tprepBureau="ssh -v -p 5422 -L localhost:5488:rfidprod-preprod.cluster-cdb9sc2xntwg.eu-west-1.rds.amazonaws.com:5432 ofbiz@pp-sftp-technical.decathlon.net"
alias tprodMaison='ssh -A -L localhost:5488:localhost:5489 nereide@naxos.nereide.fr "ssh -p5422 -L localhost:5489:rfidprod-production.cluster-cppfo25bfalv.eu-west-1.rds.amazonaws.com:5432 ofbiz@pp-sftp-technical.decathlon.net"'
alias tprodBureau="ssh -v -p 5422 -L localhost:5488:rfidprod-production.cluster-cppfo25bfalv.eu-west-1.rds.amazonaws.com:5432 ofbiz@pp-sftp-technical.decathlon.net"
# ofbiz specific
alias resetTestDb='dropdb ofbiz && createdb ofbiz && ./gradlew "ofbiz -l readers=seed,seed-initial -l delegator=test"'
alias testRfid='./gradlew "ofbiz --test component=rfid --test delegator=test"'
alias testIntegOFbiz='./gradlew cleanAll loadAll testIntegration'
alias reducePdf="gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen \
-dNOPAUSE -dBATCH -dColorImageResolution=150 \
-sOutputFile=output.pdf"
# Reboot directly to Windows
# Inspired by http://askubuntu.com/questions/18170/how-to-reboot-into-windows-from-ubuntu
reboot_to_windows ()
{
windows_title=$(sudo grep -i windows /boot/grub/grub.cfg | cut -d "'" -f 2)
sudo grub-reboot "$windows_title" && sudo reboot
}
alias windows='reboot_to_windows'
session_name="gil"
# 1. First you check if a tmux session exists with a given name.
tmux has-session -t=$session_name 2> /dev/null
# 2. Create the session if it doesn't exists.
if [[ $? -ne 0 ]]; then
TMUX='' tmux new-session -d -s "$session_name"
fi
# 3. Attach if outside of tmux, switch if you're in tmux.
if [[ -z "$TMUX" ]]; then
tmux attach -t "$session_name"
else
tmux switch-client -t "$session_name"
fi