multiple changes

* Switch back to starship from powerline
* Switch from n to nvm
* Other random stuff
This commit is contained in:
2021-09-24 07:17:17 -04:00
parent 7ea0070a5f
commit df12e9a58c
9 changed files with 57 additions and 34 deletions

View File

@@ -86,13 +86,13 @@ brew "nnn"
brew "openjdk"
brew "pandoc"
brew "pinentry-mac"
brew "powerline-go"
brew "ruby-build"
brew "rbenv"
brew "rclone"
brew "reattach-to-user-namespace"
brew "redis"
brew "ripgrep"
brew "starship"
brew "speedtest-cli"
brew "stow"
brew "teensy_loader_cli"
@@ -139,6 +139,7 @@ cask "dropbox"
cask "duplicati"
cask "firefox"
cask "fork"
cask "gitkraken"
cask "google-chrome"
cask "google-drive-file-stream"
cask "handbrake"

View File

@@ -39,9 +39,9 @@ if [ "$system_type" = "Darwin" ]; then
brew bundle --global
fi
# Install powerline-go if necessary
if ! command -v powerline-go >/dev/null 2>&1; then
go install github.com/justjanne/powerline-go@latest
# Install starship if necessary
if ! command -v starship >/dev/null 2>&1; then
sh -c "$(curl -fsSL https://starship.rs/install.sh)"
fi
fi

View File

@@ -17,6 +17,12 @@ ecsInstanceIds() {
ecsInstanceInfo $cluster $profile | jq -r '.containerInstances[].ec2InstanceId'
}
asgInstanceIds() {
cluster=$1
profile=${2:-default}
aws autoscaling describe-auto-scaling-groups --profile $profile | jq -r '.AutoScalingGroups[] | select(.AutoScalingGroupName == "$cluster") | .Instances | map(.InstanceId) | join(" ")'
}
xecsSsh() {
cluster=$1
profile=${2:-default}
@@ -28,3 +34,16 @@ xecsSsh() {
eval $CMD
}
xasgSsh() {
cluster=$1
profile=${2:-default}
user=${3:-"ec2-user"}
key=${4:-$profile}
# KEYS=(`find ~/.ssh/*$profile*.pem | xargs -I {} echo "-i {}" | xargs`)
KEYS=(`find ~/.ssh/$key.pem | xargs -I {} echo "-i {}" | xargs`)
echo $KEYS
echo $(asgInstanceIds $cluster $profile | xargs)
CMD="xpanes -tsc \"SSM_PROFILE=$profile autossh -M 0 ${KEYS[@]} -o ServerAliveInterval=60 -o StrictHostKeyChecking=no $user@{}\" $(asgInstanceIds $cluster $profile | xargs)"
echo $CMD
# eval $CMD
}

View File

@@ -17,3 +17,8 @@ alias gie='git init && git commit --allow-empty -m "Initial commit"'
alias grc="git branch --merged | grep -v '\*' | grep -v master | grep -v stage | xargs -n 1 git branch -d"
alias grcr="git fetch --all -p && git branch -r --merged | grep -v '\*' | grep origin | grep -v master | grep -v stage | sed 's/origin\//:/' | xargs -n 1 echo git push origin"
krak () {
dir="$(cd "$(dirname "$1")"; pwd -P)/$(basename "$1")"
open gitkraken://repo/$dir
}

View File

@@ -1,2 +1,24 @@
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" # This loads nvm
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install
elif [ "$nvmrc_node_version" != "$node_version" ]; then
nvm use
fi
elif [ "$node_version" != "$(nvm version default)" ]; then
echo "Reverting to nvm default version"
nvm use default
fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc

View File

@@ -1,23 +0,0 @@
function powerline_precmd() {
PS1="$($GOPATH/bin/powerline-go -error $? -jobs ${${(%):%j}:-0})"
# Uncomment the following line to automatically clear errors after showing
# them once. This not only clears the error for powerline-go, but also for
# everything else you run in that shell. Don't enable this if you're not
# sure this is what you want.
#set "?"
}
function install_powerline_precmd() {
for s in "${precmd_functions[@]}"; do
if [ "$s" = "powerline_precmd" ]; then
return
fi
done
precmd_functions+=(powerline_precmd)
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
install_powerline_precmd
fi

View File

@@ -9,3 +9,5 @@
helper = osxkeychain
[pull]
rebase = false
[tag]
forceSignAnnotated = true

View File

@@ -378,6 +378,7 @@ set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'tmux-plugins/tmux-urlview'
#set -g @continuum-restore 'on'
set -g @plugin 'sainnhe/tmux-fzf'
set -g @plugin 'laktak/extrakto'
# -- custom variables ----------------------------------------------------------

6
.zshrc
View File

@@ -107,8 +107,4 @@ source $ZSH/oh-my-zsh.sh
# uninstall by removing these lines
# [ -f ~/.config/tabtab/__tabtab.fish ]; and . ~/.config/tabtab/__tabtab.fish; or true
# source <("/usr/local/bin/starship" init zsh --print-full-init)
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
source <("/usr/local/bin/starship" init zsh --print-full-init)