Last active
July 16, 2024 13:50
-
-
Save Gmousse/3a3b641803397260520b1196045cb9b6 to your computer and use it in GitHub Desktop.
A synced .zshrc used to give default config to my environment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2018 Guillaume Mousnier | |
# | |
# MIT License | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the | |
# "Software"), to deal in the Software without restriction, including | |
# without limitation the rights to use, copy, modify, merge, publish, | |
# distribute, sublicense, and/or sell copies of the Software, and to | |
# permit persons to whom the Software is furnished to do so, subject to | |
# the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be | |
# included in all copies or substantial portions of the Software. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
# | |
# To use it: | |
# - first `git clone https://gist.github.com/Gmousse/3a3b641803397260520b1196045cb9b6 .my-synced-zshrc` | |
# - then `echo "source ~/.my-synced-zshrc/.zshrc" > ~/.zshrc` | |
# - then `zsh` | |
# exports | |
export ZSH=$HOME/.oh-my-zsh | |
export ZSHRC=$HOME/.zshrc | |
export ZSHRC_SYNCED=`realpath $0` | |
export ZSHRC_SYNCED_REPO=`dirname $0` | |
export EDITOR="vim" | |
export LS_COLORS="$LS_COLORS:ow=1;34:tw=1;34:" | |
# aliases | |
## meta | |
alias zshrc-edit='vim $ZSHRC_SYNCED && zsh' | |
alias zshrc-push='cd $ZSHRC_SYNCED_REPO && git add . && ((git commit -m "updating my synced .zshrc" && git push) || git push) && cd - >& /dev/null' | |
alias zshrc-pull='cd $ZSHRC_SYNCED_REPO && git pull && cd - >& /dev/null' | |
alias aliases='cat $ZSHRC $ZSHRC_SYNCED | grep "^alias" | cut -c7-' | |
alias vars='cat $ZSHRC $ZSHRC_SYNCED | grep "^export" | cut -c8-' | |
## files | |
alias untar="tar -zxvf $@" | |
## system | |
alias ssh-last-connections='journalctl -u sshd | tail -100' | |
alias folder-sizes='du -k -d1 * | sort -nr | cut -f2 | xargs -d "\n" du -sh' | |
## docker | |
alias docker-clean-containers='docker rm -f $(docker ps -a -q)' | |
alias docker-clean-volumes='docker volume rm -f $(docker volume ls -q)' | |
alias docker-clean-networks='docker network rm $(docker network ls -q)' | |
alias docker-clean='docker-clean-containers && docker-clean-volumes && docker-clean-networks && docker-clean-images' | |
alias docker-clean-images='docker rmi $(docker images -q)' | |
## git | |
alias git-tree='git log --graph --date-order --date=format:"%d-%m-%Y | |
%H:%M" --all --pretty=format:"%C(yellow)%h%Creset - %<|(70)%s | |
%Cgreen(%ad)%Creset %Cblue<%an>%Creset%C(auto)%d%Creset"' | |
alias git-tree-full="git log --graph --all --date-order" | |
alias git-flow-before-release="git checkout develop && git pull && git checkout - && git checkout master && git pull && git checkout -" | |
alias git-flow-after-release="git checkout develop && git push && git checkout master && git push && git push --tag" | |
alias gflbr="git-flow-before-release" | |
alias gflar="git-flow-after-release" | |
# startup scripts | |
# pull-zshrc2 | |
# zsh configuration | |
ZSH_THEME="candy" | |
plugins=(git git-flow docker docker-compose kube-ps1 kubectl) | |
source $ZSH/oh-my-zsh.sh | |
PROMPT=$PROMPT'$(kube_ps1) ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment