diff --git a/.bash_profile b/.bash_profile index adca0f5..4375d31 100755 --- a/.bash_profile +++ b/.bash_profile @@ -7,20 +7,18 @@ # ------------------------------------------------------------ #export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/opt:/opt/local/bin:/opt/local/sbin:$HOME/.npm-packages/bin:/usr/local/opt/yarn/bin:$HOME/Library/Python/2.7/bin:/usr/local/opt/python/libexec/bin:/usr/local/opt/go/libexec/bin:$(go env GOPATH)/bin:$HOME/Documents/Scripts:$PATH" # Homebrew -export PATH="/usr/local/sbin:$PATH" +export PATH="/opt/homebrew/sbin:$PATH" # MySQL #export PATH=/usr/local/mysql/bin:$PATH # Homebrew Python 3.7 -export PATH=/usr/local/opt/python/libexec/bin:$PATH +export PATH=/opt/homebrew/opt/python/libexec/bin:$PATH export PATH=/Users/bruno/Library/Python/3.7/bin:$PATH -# macOS Pyhton 2.7 -#export PATH=$HOME/Library/Python/2.7/bin:$PATH # golang -#export PATH=/usr/local/opt/go/libexec/bin:$(go env GOPATH)/bin:$PATH +#export PATH=/opt/homebrew/opt/go/libexec/bin:$(go env GOPATH)/bin:$PATH # Scripts perso export PATH=$HOME/Documents/Scripts:$PATH # sqlite -export PATH="/usr/local/opt/sqlite/bin:$PATH" +export PATH="/opt/homebrew/opt/sqlite/bin:$PATH" # echo $PATH sans export ci-dessus # /Users/bruno/.nvm/versions/node/v8.11.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin @@ -31,7 +29,7 @@ export PATH="/usr/local/opt/sqlite/bin:$PATH" # Python # ------------------------------------------------------------ -export PYTHONPATH=/usr/local/lib/python3.7/site-packages +export PYTHONPATH=/opt/homebrew/lib/python3.11/site-packages export PYTHONSTARTUP=~/.pythonrc @@ -200,11 +198,11 @@ alias restorebash="cd && curl https://clicclac.info/backup/bash_silverbook.tar.g # reloads the prompt, usefull to take new modifications into account alias reload="source ~/.bash_profile && echo 'source ~/.bash_profile'" -source ~/.sh_aliases +#source ~/.sh_aliases test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" [ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion -source ~/Documents/Scripts/wp-completion.bash +#source ~/Documents/Scripts/wp-completion.bash # venv #source /usr/local/bin/activate.sh diff --git a/.zshrc b/.zshrc index 01715fb..038a2fe 100644 --- a/.zshrc +++ b/.zshrc @@ -5,6 +5,7 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]] source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi +# [[ -r "/opt/homebrew/etc/profile.d/bash_completion.sh" ]] && . "/opt/homebrew/etc/profile.d/bash_completion.sh" # --------------------------------------- # 1. fzf @@ -37,6 +38,8 @@ fif() { # 2. Path # --------------------------------------- +export PATH=/opt/homebrew/opt/python/libexec/bin:$PATH + # keg-only export PATH="/opt/homebrew/opt/ssh-copy-id/bin:$PATH" export PATH="/opt/homebrew/opt/unzip/bin:$PATH" @@ -46,6 +49,9 @@ export PATH="/opt/homebrew/opt/ruby/bin:$PATH" PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH" PATH="/opt/homebrew/opt/grep/libexec/gnubin:$PATH" +#export PATH="$PATH:`yarn global bin`" +export PATH="$PATH:$HOME/.yarn/bin" + # poetry export PATH="/Users/bruno/Library/Python/3.9/bin:$PATH" @@ -80,7 +86,7 @@ export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion -export NODE_PATH=$NODE_PATH:`npm root -g` +export NODE_PATH=$NODE_PATH:`npm root --location=global` upd_nvm() {( cd "$NVM_DIR" @@ -193,15 +199,17 @@ fh() { # 6. Options # --------------------------------------- +FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" # For poetry: https://github.com/python-poetry/poetry#enable-tab-completion-for-bash-fish-or-zsh #fpath+=~/.zfunc # additional completions -#autoload -U +X compinit && compinit +autoload -U +X compinit && compinit #pipx -autoload -U bashcompinit && bashcompinit +autoload -U +X bashcompinit && bashcompinit eval "$(register-python-argcomplete pipx)" - +[[ -r $(brew --prefix)/etc/bash_completion.d/soco-cli-gui-completion.bash ]] && source $(brew --prefix)/etc/bash_completion.d/soco-cli-gui-completion.bash + setopt auto_cd # cd by typing directory name if it's not a command (pas besoin de taper cd, juste le nom du dossier) setopt correct_all # autocorrect commands setopt auto_list # automatically list choices on ambiguous completion @@ -234,7 +242,10 @@ alias reload='source ~/.zshrc' alias change="bbedit ~/.zshrc" if [ -x "$(command -v exa)" ]; then - alias l='exa -lbhgUmaFG@ --time-style=default --git --color-scale --icons && echo' + alias l='exa -lbhgUmaFG@ --time-style=default --git --color-scale --icons --octal-permissions && echo' + alias ll='exa -lbhgUmaF --time-style=default --git --color-scale --icons --octal-permissions && echo' + # + récent d'abord + alias lt='exa -lbhgUmaFG@ --time-style=default --git --color-scale --icons --sort=mod && echo' alias ltree='exa -lbhgUma@ --time-style=default --git --color-scale --icons --tree --level=3 && echo' cd() { builtin cd "$@" && exa -lbhgUmaFG@ --time-style=default --git --color-scale --icons && echo; } @@ -354,6 +365,16 @@ b() { function dirdiff () { diff <(cd $1 && gfind | sort) <(cd $2 && gfind | sort) | colordiff | less -R; } +# Move to Trash +function rem { + for b in "$@" + do + osascript -e "tell app \"Finder\" to delete POSIX file \"${PWD}/$b\"" + done +} +# brew install macos-trash +alias rmt='trash' + # ---------------------------- # 7.b GIT # ---------------------------- @@ -460,6 +481,11 @@ ff () { /usr/bin/find . -name "$@" ; } # ff: Find file under the curr ffs () { /usr/bin/find . -name "$@"'*' ; } # ffs: Find file whose name starts with a given string ffe () { /usr/bin/find . -name '*'"$@" ; } # ffe: Find file whose name ends with a given string +if [ -x "$(command -v fd)" ]; then + alias 1g="fd -HI --size +1g . '/'" # fichiers > 1Go +else + alias 1g='find / -size +1G -print 2>/dev/null' # fichiers > 1Go +fi # --------------------------- # 7.g NETWORKING @@ -518,6 +544,10 @@ alias log2='less +F /opt/homebrew/var/log/httpd/error_log' alias editHosts='sudo edit /etc/hosts' # editHosts: Edit /etc/hosts file httpHeaders () { /usr/bin/curl -I -L $@ ; } # httpHeaders: Grabs headers from web page +alias php81='/opt/homebrew/opt/php@8.1/bin/php' +alias php82='/opt/homebrew/opt/php@8.2/bin/php' +alias php='php82' + # --------------------------------------- # 7.i ALIAS GLOBAUX @@ -624,6 +654,7 @@ alias typora="open -a typora" # De-quarantine alias quarantine="sudo xattr -rd com.apple.quarantine" +alias decodesign="codesign -f -s - --deep" # Optimise la base Mail alias mailoptimiser="curl -sS https://raw.githubusercontent.com/pbihq/tools/master/MailDBOptimiser/MailDBOptimiser.sh | bash" @@ -632,7 +663,26 @@ alias mailoptimiser="curl -sS https://raw.githubusercontent.com/pbihq/tools/mast alias mt='multitail -F /usr/local/etc/multitail.conf' # Convert video to Plex AppleTV -alias atv="$HOME/.local/bin/convert-videos-for-plex.sh -fr" +alias atv="$HOME/.local/bin/handbrake_for_plex.sh" + +#Get tags from image to Instagram +#alias k2i="$HOME/.local/bin/keywords2insta.sh -f $1" +alias k2i='$HOME/Documents/Scripts/keywords2insta/keywords2insta.sh -f ' + +# Convert man page to pdf +pman () {man -t "${1}" | open -fa "Preview"} + +function manpdf { + man "$1" > /dev/null + if [[ ! "$?" == 16 ]] ; then + echo '-> Création du manuel en PDF de "'"$1"'"'; + foldermanpdf="$HOME/Documents/man2pdf"; + [ -d "$foldermanpdf" ] || mkdir -p "$foldermanpdf"; + man -t "$1" | ps2pdf - "$foldermanpdf"/manpage-"$1".pdf; + echo '-> "manpage-'$1'.pdf" se trouve dans '$foldermanpdf; + [ "$2" == "o" ] && xdg-open "$foldermanpdf"/manpage-"$1".pdf>/dev/null 2>&1; + fi +} # --------------------------------------- # 7.l Backup (dotbare...) @@ -643,6 +693,7 @@ alias dbadd='dotbare add -f $1' alias dbcomm='dotbare commit -am $1' alias dbback='dotbare fbackup' +alias backup_air='sudo rsync -av --files-from=$HOME/rsync-list.txt / "$HOME/Documents/Backup"' # --------------------------------------- # 8. FONCTIONS