From 9d82a465f465c276f4425cdf130873506a4dba67 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Wed, 20 Jan 2021 21:03:39 +0100 Subject: [PATCH 1/7] feat: add sdkman --- .bashrc | 5 +++++ .zshrc | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.bashrc b/.bashrc index 89b93b7..c43691e 100644 --- a/.bashrc +++ b/.bashrc @@ -120,3 +120,8 @@ alias vim='nvim' alias vim='nvim' alias vim='nvim' alias vim='nvim' +alias vim='nvim' + +#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! +export SDKMAN_DIR="/home/jim/.sdkman" +[[ -s "/home/jim/.sdkman/bin/sdkman-init.sh" ]] && source "/home/jim/.sdkman/bin/sdkman-init.sh" diff --git a/.zshrc b/.zshrc index d343294..2d71e18 100644 --- a/.zshrc +++ b/.zshrc @@ -35,11 +35,15 @@ export PATH="$PATH:$HOME/.yarn/bin" export PATH="$PATH:$HOME/.local/bin" export PATH="$PATH:$HOME/go/bin" +export GOROOT="$HOME/go" +export GOPATH="$HOME/SYNC" +export PATH="$PATH:$GOROOT/bin" + eval "$(direnv hook zsh)" #Java version manager export SDKMAN_DIR="$HOME/.sdkman" -[[ -s "$HOME/jim/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh" +[[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh" # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh @@ -49,4 +53,4 @@ export SDKMAN_DIR="$HOME/.sdkman" # Node Version manager export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \ No newline at end of file +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" From 24d24cab77736702cd1199eb5bc12355a7187e4f Mon Sep 17 00:00:00 2001 From: Max Richter Date: Wed, 20 Jan 2021 21:22:53 +0100 Subject: [PATCH 2/7] feat: some changes --- configs/.bashrc | 25 +------------------------ configs/.zshrc | 18 ------------------ setup.sh | 19 +++++++++++++++---- 3 files changed, 16 insertions(+), 46 deletions(-) diff --git a/configs/.bashrc b/configs/.bashrc index 6862d6f..9cf2110 100644 --- a/configs/.bashrc +++ b/configs/.bashrc @@ -110,27 +110,4 @@ if ! shopt -oq posix; then elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi -fi - -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 -alias vim='nvim' -alias vim='nvim' -alias vim='nvim' -alias vim='nvim' -alias vim='nvim' -alias vim='nvim' -<<<<<<< HEAD:.bashrc - -#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! -export SDKMAN_DIR="/home/jim/.sdkman" -[[ -s "/home/jim/.sdkman/bin/sdkman-init.sh" ]] && source "/home/jim/.sdkman/bin/sdkman-init.sh" -======= -alias vim='nvim' -alias vim='nvim' -alias vim='nvim' -alias vim='nvim' - -[[ -s "/home/jim/.gvm/scripts/gvm" ]] && source "/home/jim/.gvm/scripts/gvm" ->>>>>>> 63919a2fee0f7a41a5f3dd6b89def7847aa42cae:configs/.bashrc +fi \ No newline at end of file diff --git a/configs/.zshrc b/configs/.zshrc index 56bf1a4..d3ad850 100644 --- a/configs/.zshrc +++ b/configs/.zshrc @@ -27,17 +27,6 @@ source $HOME/.dotfiles/configs/zsh/aliases.sh export PATH="$PATH:$HOME/.yarn/bin" export PATH="$PATH:$HOME/.local/bin" -<<<<<<< HEAD:.zshrc -export GOROOT="$HOME/go" -export GOPATH="$HOME/SYNC" -export PATH="$PATH:$GOROOT/bin" - -eval "$(direnv hook zsh)" - -#Java version manager -export SDKMAN_DIR="$HOME/.sdkman" -[[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh" -======= ## GO STUFF export GOROOT="/usr/local/bin/go" export GOPATH="$HOME/go" @@ -55,7 +44,6 @@ fi #Java version manager export SDKMAN_DIR="$HOME/.sdkman" [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh" ->>>>>>> 63919a2fee0f7a41a5f3dd6b89def7847aa42cae:configs/.zshrc # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh @@ -66,9 +54,3 @@ export SDKMAN_DIR="$HOME/.sdkman" # Node Version manager export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" -<<<<<<< HEAD:.zshrc -======= - -# To customize prompt, run `p10k configure` or edit ~/.dotfiles/configs/.p10k.zsh. -[[ ! -f ~/.dotfiles/configs/.p10k.zsh ]] || source ~/.dotfiles/configs/.p10k.zsh ->>>>>>> 63919a2fee0f7a41a5f3dd6b89def7847aa42cae:configs/.zshrc diff --git a/setup.sh b/setup.sh index e9f69ab..d3ee9fc 100755 --- a/setup.sh +++ b/setup.sh @@ -9,9 +9,13 @@ cd "$(dirname "$0")" echo "-- welcome to my setup script --" echo "-- installing prerequesits (git, curl) --" -if [ "$(prompt " - do you want to continue")" != "yes" ]; then - echo " alllrighty then, byyye" - exit +INTERACTIVE=$(tty -s && echo "true" || echo "false") + +if [ $INTERACTIVE = "true" ]; then + if [ "$(prompt " - do you want to continue")" != "yes" ]; then + echo " alllrighty then, byyye" + exit + fi fi echo "" @@ -32,7 +36,10 @@ OPTIONS_LABELS=("zsh + oh-my-zsh" "Neovim" "Direnv" "Go Version Manager" "Node V for i in "${!OPTIONS_VALUES[@]}"; do OPTIONS_STRING+="${OPTIONS_VALUES[$i]} (${OPTIONS_LABELS[$i]});" done -multiselect SELECTED "$OPTIONS_STRING" + +if [ $INTERACTIVE = "true" ]; then + multiselect SELECTED "$OPTIONS_STRING" +fi # Variables INST_ZSH=${SELECTED[0]} @@ -42,6 +49,10 @@ INST_GVM=${SELECTED[3]} INST_NVM=${SELECTED[4]} INST_SDKM=${SELECTED[5]} +if [ $INTERACTIVE = "false" ]; then + INST_ZSH = true +fi + echo "-----------------------------------" echo -e "-- installing programs --" From 37365ac9638244d88a9e50ac1133a6cfd567dd7d Mon Sep 17 00:00:00 2001 From: Max Richter Date: Wed, 20 Jan 2021 21:35:34 +0100 Subject: [PATCH 3/7] fix --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index d3ee9fc..67502eb 100755 --- a/setup.sh +++ b/setup.sh @@ -50,7 +50,7 @@ INST_NVM=${SELECTED[4]} INST_SDKM=${SELECTED[5]} if [ $INTERACTIVE = "false" ]; then - INST_ZSH = true + INST_ZSH=true fi echo "-----------------------------------" From dd5d566080855e1e04e313185093bcf655b660ae Mon Sep 17 00:00:00 2001 From: Jim Richter Date: Thu, 21 Jan 2021 12:39:57 +0000 Subject: [PATCH 4/7] feat: add optional loading of gcloud autocomplete --- configs/.zshrc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configs/.zshrc b/configs/.zshrc index d3ad850..9f51bdc 100644 --- a/configs/.zshrc +++ b/configs/.zshrc @@ -26,6 +26,7 @@ source $HOME/.dotfiles/configs/zsh/aliases.sh ## LOADING PROGRAMS export PATH="$PATH:$HOME/.yarn/bin" export PATH="$PATH:$HOME/.local/bin" +export PATH="$PATH:$HOME/bin" ## GO STUFF export GOROOT="/usr/local/bin/go" @@ -40,7 +41,6 @@ if [ -s "$HOME/.pyenv" ]; then eval "$(pyenv init -)" fi - #Java version manager export SDKMAN_DIR="$HOME/.sdkman" [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh" @@ -54,3 +54,9 @@ export SDKMAN_DIR="$HOME/.sdkman" # Node Version manager export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + +# The next line updates PATH for the Google Cloud SDK. +if [ -f '/home/coder/downloads/google-cloud-sdk/path.zsh.inc' ]; then . '/home/coder/downloads/google-cloud-sdk/path.zsh.inc'; fi + +# The next line enables shell command completion for gcloud. +if [ -f '/home/coder/downloads/google-cloud-sdk/completion.zsh.inc' ]; then . '/home/coder/downloads/google-cloud-sdk/completion.zsh.inc'; fi From 4d24e9b47e0b7a45d47990dd51d4c8010cd5b72b Mon Sep 17 00:00:00 2001 From: Jim Richter Date: Thu, 21 Jan 2021 12:40:08 +0000 Subject: [PATCH 5/7] feat: add free port (fp) function --- configs/zsh/functions.zsh | 3 ++- configs/zsh/functions/fp.zsh | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 configs/zsh/functions/fp.zsh diff --git a/configs/zsh/functions.zsh b/configs/zsh/functions.zsh index 6b5698b..977a91b 100644 --- a/configs/zsh/functions.zsh +++ b/configs/zsh/functions.zsh @@ -2,4 +2,5 @@ source $(dirname "$0")/functions/co.zsh; source $(dirname "$0")/functions/fx.zsh; source $(dirname "$0")/functions/start.zsh; source $(dirname "$0")/functions/wp.zsh; -source $(dirname "$0")/functions/y.zsh; \ No newline at end of file +source $(dirname "$0")/functions/y.zsh; +source $(dirname "$0")/functions/fp.zsh; \ No newline at end of file diff --git a/configs/zsh/functions/fp.zsh b/configs/zsh/functions/fp.zsh new file mode 100644 index 0000000..4e894f6 --- /dev/null +++ b/configs/zsh/functions/fp.zsh @@ -0,0 +1,29 @@ +#Helps stop processes which use ports + +function fp(){ + + PORT=$1; + + if [ "$(which lsof)" = "lsof not found" ]; then + echo "lsof not installed" + else + PIDS="$(lsof -t -i:$PORT)" + + AMOUNT=$(wc -w<<<$PIDS); + + if [ $AMOUNT = 0 ]; then + + echo "No processes use port $PORT"; + + else + + echo "Killing $AMOUNT process(es) using port $PORT"; + + echo "$PIDS" | while IFS= read -r pid ; do + kill -9 $pid; + done + + fi + fi + +} \ No newline at end of file From 4158e1e7c4e8471eeb43af90219a3916aa744e84 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Thu, 21 Jan 2021 13:43:28 +0100 Subject: [PATCH 6/7] Delete .gitconfig-coco --- .gitconfig-coco | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .gitconfig-coco diff --git a/.gitconfig-coco b/.gitconfig-coco deleted file mode 100644 index bacea67..0000000 --- a/.gitconfig-coco +++ /dev/null @@ -1,3 +0,0 @@ -[user] -name = Max Richter -email = max.richter@smail.th-koeln.de \ No newline at end of file From 223e12be19c7352ff544a33be9553951716f94c7 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Thu, 21 Jan 2021 13:43:40 +0100 Subject: [PATCH 7/7] Delete .gitconfig --- .gitconfig | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .gitconfig diff --git a/.gitconfig b/.gitconfig deleted file mode 100644 index 8fed6b5..0000000 --- a/.gitconfig +++ /dev/null @@ -1,5 +0,0 @@ -[user] -email = jim-x@web.de -name = Max Richter -[includeIf "gitdir:~/COCO"] -path = .gitconfig-coco \ No newline at end of file