aliases: General cleanup

This commit is contained in:
Robin-Charles Guihéneuf 2020-10-23 09:32:47 +02:00
parent 006f44b2cc
commit 91e51f8d4b

View File

@ -1,19 +1,29 @@
export CONFIG_DIR="$HOME/.dotfiles" export CONFIG_DIR="$HOME/.dotfiles"
# Refresh # ╦═╗┌─┐┌─┐┬─┐┌─┐┌─┐┬ ┬
# ╠╦╝├┤ ├┤ ├┬┘├┤ └─┐├─┤
# ╩╚═└─┘└ ┴└─└─┘└─┘┴ ┴
if [ -z "${ZSH}" ]; then if [ -z "${ZSH}" ]; then
alias refresh=". $HOME/.bashrc" alias refresh=". $HOME/.bashrc"
else else
alias refresh=". $HOME/.zshrc" alias refresh=". $HOME/.zshrc"
fi fi
# Nautilus # ╦┌┐┌┌─┐┌┬┐┌─┐┬ ┬
alias open="nautilus ." # ║│││└─┐ │ ├─┤│ │
# ╩┘└┘└─┘ ┴ ┴ ┴┴─┘┴─┘
# Install scripts
alias install_cli="$CONFIG_DIR/auto-config-cli.sh" alias install_cli="$CONFIG_DIR/auto-config-cli.sh"
alias install_gui="$CONFIG_DIR/auto-config.sh" alias install_gui="$CONFIG_DIR/auto-config.sh"
# ╔╦╗╦╔═╗╔═╗
# ║║║║╚═╗║
# ╩ ╩╩╚═╝╚═╝
# Nautilus
alias open="nautilus ."
# Go to config directory # Go to config directory
alias config="cd $CONFIG_DIR" alias config="cd $CONFIG_DIR"
@ -52,33 +62,43 @@ function s_clean {
s_on s_on
} }
# Make
alias mk='make -j5'
alias mec='make'
alias mecque='make'
# VPN # VPN
alias vpn="sudo openvpn --config $HOME/Nextcloud/#\ -\ Configs/rguiheneuf.ovpn" alias vpn="sudo openvpn --config $HOME/Nextcloud/#\ -\ Configs/rguiheneuf.ovpn"
# Git # ╔═╗┬┌┬┐ ╔═╗┬ ┬┌─┐┌─┐┌─┐┌─┐
alias gst='git status' # ║ ╦│ │ ╠═╣│ │├─┤└─┐├┤ └─┐
# ╚═╝┴ ┴ ╩ ╩┴─┘┴┴ ┴└─┘└─┘└─┘
alias gs='git status'
alias gc='git checkout' alias gc='git checkout'
alias gcm='git checkout master' alias gcm='git checkout master'
alias gpl='git pull' alias gpl='git pull'
alias gph='git push' alias gph='git push'
alias pull='git pull'
alias push='git push'
alias gsu='git submodule update --init' alias gsu='git submodule update --init'
alias gcp='git cherry-pick'
alias add='git add' alias add='git add'
alias commit='git commit -m "To fixup"' alias commit='git commit -m "To fixup"'
alias cont='git rebase --continue' alias cont='git rebase --continue'
# Git cleaners
alias branch_clean='git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d' alias branch_clean='git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d'
alias tag_clean='git tag -l | xargs git tag -d && git fetch -t'
alias log='git log --graph --decorate --oneline'
# Branch
function branch_create { function branch_create {
git checkout -b $1 git checkout -b $1
git push -u origin $1 git push -u origin $1
} }
# Tag # Tag helpers
alias tag_clean='git tag -l | xargs git tag -d && git fetch -t'
function tag_create { function tag_create {
git tag $1 git tag $1
git push origin $1 git push origin $1
@ -91,18 +111,22 @@ function tag_replace {
git push origin $1 git push origin $1
} }
function grb {
git rebase -i HEAD~$1
}
function g_save { function g_save {
git add * git add *
git commit -m "[skip ci] Save: do not merge" git commit -m "[skip ci] Save: do not merge"
git push -f git push -f
} }
# ╔═╗┬┌┬┐ ╦═╗┌─┐┌┐ ┌─┐┌─┐┌─┐
# ║ ╦│ │ ╠╦╝├┤ ├┴┐├─┤└─┐├┤
# ╚═╝┴ ┴ ╩╚═└─┘└─┘┴ ┴└─┘└─┘
function grb {
git rebase --interactive HEAD~$1
}
function grbm { function grbm {
# Save actual branch # Save current branch
BRANCH=$(git branch | grep \* | cut -d ' ' -f2) BRANCH=$(git branch | grep \* | cut -d ' ' -f2)
# Checkout master & pull # Checkout master & pull
@ -111,7 +135,7 @@ function grbm {
# Back to previous branch # Back to previous branch
git checkout ${BRANCH} git checkout ${BRANCH}
git rebase -i master git rebase --interactive master
} }
function grbr { function grbr {
@ -128,11 +152,17 @@ function ga {
git rebase --interactive --autosquash HEAD~$1 git rebase --interactive --autosquash HEAD~$1
} }
# Git amend # ╔═╗┬┌┬┐ ╔═╗┌┬┐┌─┐┌┐┌┌┬┐
# ║ ╦│ │ ╠═╣│││├┤ │││ ││
# ╚═╝┴ ┴ ╩ ╩┴ ┴└─┘┘└┘─┴┘
alias amend_pro="GIT_EDITOR=true git rebase --preserve-merges --exec 'git commit --amend --author=\"Robin-Charles GUIHENEUF <rguiheneuf@netatmo.com>\"' $1" alias amend_pro="GIT_EDITOR=true git rebase --preserve-merges --exec 'git commit --amend --author=\"Robin-Charles GUIHENEUF <rguiheneuf@netatmo.com>\"' $1"
alias amend_perso="GIT_EDITOR=true git rebase --preserve-merges --exec 'git commit --amend --author=\"Robin-Charles Guihéneuf <robin-charles@hotmail.fr>\"' $1" alias amend_perso="GIT_EDITOR=true git rebase --preserve-merges --exec 'git commit --amend --author=\"Robin-Charles Guihéneuf <robin-charles@hotmail.fr>\"' $1"
# Repositories # ╦═╗┌─┐┌─┐┌─┐┌─┐┬┌┬┐┌─┐┬─┐┬┌─┐┌─┐
# ╠╦╝├┤ ├─┘│ │└─┐│ │ │ │├┬┘│├┤ └─┐
# ╩╚═└─┘┴ └─┘└─┘┴ ┴ └─┘┴└─┴└─┘└─┘
alias bc='cd $HOME/Netatmo/embedded/firmware-bitcloud' alias bc='cd $HOME/Netatmo/embedded/firmware-bitcloud'
alias fw='cd $HOME/Netatmo/embedded/firmware' alias fw='cd $HOME/Netatmo/embedded/firmware'
alias nmr='cd $HOME/Netatmo/embedded/nmr' alias nmr='cd $HOME/Netatmo/embedded/nmr'
@ -141,7 +171,7 @@ alias mag='cd $HOME/Netatmo/embedded/magellan'
alias nsp='cd $HOME/Netatmo/embedded/nsp' alias nsp='cd $HOME/Netatmo/embedded/nsp'
alias mulot='cd $HOME/mulot/firmware' alias mulot='cd $HOME/mulot/firmware'
# Repositories in editor # In editor
alias c_bc='c $HOME/Netatmo/firmware-bitcloud.code-workspace' alias c_bc='c $HOME/Netatmo/firmware-bitcloud.code-workspace'
alias c_fw='c $HOME/Netatmo/firmware.code-workspace' alias c_fw='c $HOME/Netatmo/firmware.code-workspace'
alias c_nmr='c $HOME/Netatmo/nmr.code-workspace' alias c_nmr='c $HOME/Netatmo/nmr.code-workspace'
@ -158,6 +188,10 @@ function ssh_keygen {
cd - cd -
} }
# ╔╗╔┌─┐┌┬┐┌─┐┌┬┐┌┬┐┌─┐
# ║║║├┤ │ ├─┤ │ ││││ │
# ╝╚╝└─┘ ┴ ┴ ┴ ┴ ┴ ┴└─┘
# Flash sniffer nRF52 # Flash sniffer nRF52
function nrf52 { function nrf52 {
arm-none-eabi-objcopy -O ihex output/nrf52840/bin/$1 $1.hex arm-none-eabi-objcopy -O ihex output/nrf52840/bin/$1 $1.hex
@ -171,11 +205,6 @@ function nrf52 {
fi fi
} }
# Make
alias mk='make -j5'
alias mec='make'
alias mecque='make'
# app.S # app.S
function generate_objdump { function generate_objdump {
arm-none-eabi-objdump -S $1.elf > app.S arm-none-eabi-objdump -S $1.elf > app.S
@ -192,6 +221,10 @@ alias py_wireshark='$HOME/Netatmo/core/python-emb-tools/python/bin/zigbee/python
alias stflash='sudo stm32_sbm -f app.bin -s 0x1000 -d' alias stflash='sudo stm32_sbm -f app.bin -s 0x1000 -d'
alias stflash_dfu='stm32_dfu -f app-jtag.bin -b' alias stflash_dfu='stm32_dfu -f app-jtag.bin -b'
# ╔═╗┬┌┬┐ ╔═╗┬─┐┌─┐┌┬┐┌─┐┌┬┐
# ║ ╦│ │ ╠═╝├┬┘│ ││││├─┘ │
# ╚═╝┴ ┴ ╩ ┴└─└─┘┴ ┴┴ ┴
# Git prompt # Git prompt
if [ -z "${ZSH}" ]; then if [ -z "${ZSH}" ]; then
if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then
@ -204,11 +237,9 @@ else
fi fi
fi fi
# Autofixup # ╔═╗─┐ ┬┌─┐┌─┐┬─┐┌┬┐
export PATH=$PATH:$HOME/.git-autofixup # ║╣ ┌┴┬┘├─┘│ │├┬┘ │
# ╚═╝┴ └─┴ └─┘┴└─ ┴
# Netatmo
export NETATMO_WORK_DIR=$HOME/Netatmo
export PATH=$PATH:~/Netatmo/core/embedded-tools/Linux/flasher export PATH=$PATH:~/Netatmo/core/embedded-tools/Linux/flasher
export PATH=$PATH:~/Netatmo/core/generic-embedded/stm32_sbm export PATH=$PATH:~/Netatmo/core/generic-embedded/stm32_sbm
@ -216,6 +247,12 @@ export PATH=$PATH:~/Netatmo/core/generic-embedded/stm32_dfu
export PATH=$PATH:~/Netatmo/embedded/firmware-bitcloud/toolchain/arm-none-eabi/bin export PATH=$PATH:~/Netatmo/embedded/firmware-bitcloud/toolchain/arm-none-eabi/bin
export PATH=$PATH:~/Netatmo/embedded/nmr/scripts/flash export PATH=$PATH:~/Netatmo/embedded/nmr/scripts/flash
# Autofixup
export PATH=$PATH:$HOME/.git-autofixup
# Netatmo
export NETATMO_WORK_DIR=$HOME/Netatmo
# Cargo binaries (navi) # Cargo binaries (navi)
export PATH=$PATH:$HOME/.cargo/bin export PATH=$PATH:$HOME/.cargo/bin