Created
April 21, 2024 03:41
-
-
Save antoniopresto/cc55ec79fe06172eb0d5e9ee166d019f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
export PATH=$HOME/bin:/usr/local/bin:$PATH | |
export PATH=/Users/$USER/.pyenv/versions/2.7.18/bin:$PATH | |
alias reload="source ~/.zshrc" | |
alias w="webstorm" | |
alias zshrc="idea ~/.zshrc" | |
alias i="pm install" | |
alias rr="cargo-watch -x run" | |
echopm(){ | |
local dir=${1:-$(pwd)} | |
if [[ -f "$dir/package-lock.json" ]]; then | |
echo "npm" | |
elif [[ -f "$dir/bun.lockb" ]]; then | |
echo "bun" | |
elif [[ -f "$dir/yarn.lock" ]]; then | |
echo "yarn" | |
elif [[ -f "$dir/pnpm-lock.yaml" ]]; then | |
echo "pnpm" | |
fi | |
} | |
pm() { | |
local pmResult="" | |
local pmPath=$(pwd) | |
local pmNextPath=$pmPath | |
for i in {0..2}; do | |
pmResult=$(echopm "$pmNextPath") | |
if [[ $pmResult != "" ]]; then | |
command $pmResult "$@" | |
return 0; | |
fi | |
pmNextPath=$(dirname "$pmNextPath") | |
done | |
return 1 | |
} | |
gitreset() { | |
git add . | |
COMMIT_SUCCESS=false | |
if git commit -m 'temp'; then | |
COMMIT_SUCCESS=true | |
fi | |
git clean -fdx -e .idea | |
if [ "$COMMIT_SUCCESS" = true ]; then | |
git reset --soft HEAD~1 | |
fi | |
rm -rf pnpm-lock.yaml | |
rm -rf bun.lockb | |
rm -rf yarn.lock | |
} | |
root() { | |
local pmResult="" | |
local pmPath=$(pwd) | |
local pmNextPath=$pmPath | |
for i in {0..7}; do | |
pmResult=$(echopm "$pmNextPath") | |
if [[ $pmResult != "" ]]; then | |
cd $pmNextPath | |
return 0 | |
fi | |
pmNextPath=$(dirname "$pmNextPath") | |
done | |
return 1 | |
} | |
git() { | |
if [[ $1 == "backup" ]]; then | |
shift # Remove 'backup' da lista de argumentos | |
git add . | |
local hash=$(date +%s | sha256sum | base64 | head -c 6) | |
git checkout -b "temp_$hash" | |
git checkout - | |
git reset --soft HEAD~1 | |
else | |
command git "$@" | |
fi | |
} | |
# Homebrew | |
export PATH=/opt/homebrew/bin:$PATH | |
# bun | |
export BUN_INSTALL="$HOME/.bun" | |
export PATH="$BUN_INSTALL/bin:$PATH" | |
# bun completions | |
[ -s "/Users/$USER/.bun/_bun" ] && source "/Users/$USER/.bun/_bun" | |
# pnpm | |
export PNPM_HOME="/Users/$USER/Library/pnpm" | |
case ":$PATH:" in | |
*":$PNPM_HOME:"*) ;; | |
*) export PATH="$PNPM_HOME:$PATH" ;; | |
esac | |
# pnpm end | |
export ZSH="$HOME/.oh-my-zsh" | |
ZSH_THEME="robbyrussell" | |
plugins=(git) | |
source $ZSH/oh-my-zsh.sh | |
export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home" | |
export ANDROID_HOME="$HOME/Library/Android/sdk" | |
export NDK_HOME="$ANDROID_HOME/ndk/25.0.8775105" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment