Created
June 29, 2019 18:26
-
-
Save Darkflib/7d28d6a594736ee48645825a711883ed to your computer and use it in GitHub Desktop.
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
# Set the window title | |
function title { | |
echo -ne "\033]0;"$*"\007" | |
} | |
title "MBP" | |
# autossh | |
function as() { | |
echo -ne "\033]0;"$1"\007" | |
autossh -M 0 -t $1; | |
echo -ne "\033]0;"MBP"\007" | |
} | |
# autossh with tmux | |
function ast() { | |
echo -ne "\033]0;"$1"\007" | |
autossh -M 0 -t $1 tmux new -s mike -A; | |
echo -ne "\033]0;"MBP"\007" | |
} | |
# list okta profiles | |
function aol() { aws-okta list; } | |
# open aws console | |
function aoconsole() { aws-okta login $1; } | |
# open a new bash process as a specific okta profile | |
function aoshell() { | |
export AWS_OKTA_PROFILE=$1; | |
OLDPS1=$PS1; | |
export PS1="\e[0;31m${AWS_OKTA_PROFILE}\e[m \[\033]0;\w\007\]┌─[\[\e[0;36m\]0\[\e[39m\]][\[\e[0;36m\]\W\[\e[0m\]] └─▪ "; | |
aws-okta exec $1 -- bash; | |
PS1=$OLDPS1; | |
unset AWS_OKTA_PROFILE; | |
} | |
# Pimp my history search | |
bind '"\e[A"':history-search-backward | |
bind '"\e[B"':history-search-forward | |
ssh-add -k .ssh/Personal/darkflib-2017 | |
ssh-add -k .ssh/Personal/darkflib-2018 | |
ssh-add -k .ssh/Personal/darkflib-2019 | |
clear | |
# fix history | |
export SHELL_SESSION_HISTORY=0 | |
export HISTCONTROL=erasedups | |
export HISTSIZE=10000 | |
shopt -s histappend | |
# makes aws-okta behave more sanely for my use | |
export AWS_ASSUME_ROLE_TTL=12h | |
export AWS_OKTA_MFA_PROVIDER=GOOGLE | |
export AWS_OKTA_MFA_FACTOR_TYPE=token:software:totp | |
# check if tmux is running in this shell... | |
# if so, don't use an image (tmux + image = bad news as image height is not detectable) | |
if [[ -z "${TMUX}" ]]; then | |
neofetch --backend iterm2 --source ~/Downloads/badger.png | |
else | |
neofetch --ascii "$(fortune -o |cowsay -W 50)" |lolcat | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just a fragment of it, but the interesting stuff