Cleanup and Add google
This commit is contained in:
parent
7eabb86773
commit
1de687b22b
@ -1 +0,0 @@
|
||||
Subproject commit b8a285f0f1a86cfef4adb04dc9ea7bb689c4d6cc
|
@ -3,6 +3,21 @@
|
||||
## errol@sancaktar.net
|
||||
##
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
|
||||
# HomeBrew
|
||||
|
||||
## Check for HomeBrew
|
||||
@ -60,25 +75,6 @@ brew_packages=(
|
||||
"spotify_player"
|
||||
)
|
||||
|
||||
function alacritty_config_setup {
|
||||
if [[ -f $HOME/.config/alacritty/alacritty-base.toml ]]; then
|
||||
# echo $(pwd)
|
||||
toml_files=("$HOME/.config/alacritty/alacritty-base.toml" "$HOME/.config/alacritty/alacritty-$1.toml")
|
||||
combined_file="$HOME/.config/alacritty/alacritty.toml"
|
||||
echo -n >"$combined_file"
|
||||
for file in "${toml_files[@]}"; do
|
||||
# Check if the file exists
|
||||
if [ -f "$file" ]; then
|
||||
# Append content of the current TOML file to the combined file
|
||||
cat "$file" >>"$combined_file"
|
||||
# Add a newline to separate TOML sections (optional)
|
||||
echo >>"$combined_file"
|
||||
else
|
||||
echo "File '$file' not found. Skipping."
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
function shell_start_disp {
|
||||
echo -n "$(hostname) - "
|
||||
if [[ -f /sbin/ifconfig ]]; then
|
||||
@ -96,9 +92,6 @@ if [[ $(uname) == "Linux" ]]; then
|
||||
# The next line enables shell command completion for gcloud.
|
||||
# if [ -f '/home/errol/google-cloud-sdk/completion.zsh.inc' ]; then . '/home/errol/google-cloud-sdk/completion.zsh.inc'; fi
|
||||
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
|
||||
|
||||
# Alacritty Crap
|
||||
alacritty_config_setup linux
|
||||
fi
|
||||
|
||||
## IF MacOS
|
||||
@ -107,9 +100,11 @@ if [[ $(uname) == "Darwin" ]]; then
|
||||
if [ -d /opt/homebrew/bin ]; do
|
||||
export PATH="/opt/homebrew/bin:$PATH"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Alacritty Crap
|
||||
alacritty_config_setup osx
|
||||
# Google Stuff
|
||||
if [[ -r ~/.googlerc ]]; then
|
||||
. ~/.googlerc
|
||||
fi
|
||||
|
||||
shell_start_disp
|
||||
@ -146,7 +141,7 @@ function h() {
|
||||
if which starship &>/dev/null; then
|
||||
eval "$(starship init zsh)"
|
||||
else
|
||||
curl -sS https://starship.rs/install.sh | sh
|
||||
echo "Starship not Installed, Install with: curl -sS https://starship.rs/install.sh | sh"
|
||||
fi
|
||||
|
||||
export PATH="$PATH:/Users/errol/.local/bin"
|
40
config.yaml
40
config.yaml
@ -5,25 +5,51 @@
|
||||
|
||||
- clean: ['~']
|
||||
- link:
|
||||
~/.config/alacritty/alacritty.toml:
|
||||
~/.config/alacritty/alacritty.toml:
|
||||
path: alacritty/alacritty.toml
|
||||
|
||||
~/.config/alacritty/alacritty.toml:
|
||||
~/.config/alacritty/alacritty.toml:
|
||||
if: '[ `hostname` = esancakt-mac.roam.internal ]'
|
||||
path: alacritty/alacritty.gmac.toml
|
||||
|
||||
~/.config/alacritty/themes:
|
||||
~/.config/alacritty/themes:
|
||||
path: alacritty/themes
|
||||
|
||||
|
||||
~/.zshrc: zsh/.zshrc
|
||||
~/.zprofile: zsh/.zprofile
|
||||
## Shell Stuff
|
||||
~/.tmux.conf:
|
||||
if: '`command -v tmux >/dev/null 2>&1`'
|
||||
path: tmux/tmux.conf
|
||||
|
||||
~/.tmux.conf: tmux/.tmux.conf
|
||||
~/.aliasrc:
|
||||
path: shell/aliasrc
|
||||
|
||||
~/.aliasrc: shell/.aliasrc
|
||||
## Bash
|
||||
~/.bashrc:
|
||||
if: '[ $SHELL == "/bin/bash" ]'
|
||||
path: bash/bashrc
|
||||
|
||||
~/.bash_profile:
|
||||
if: '[ $SHELL == "/bin/bash" ]'
|
||||
path: bash/bash_profile
|
||||
|
||||
~/.bash_completion.d:
|
||||
if: '[ $SHELL == "/bin/bash" ]'
|
||||
path: bash/bash_completion.d
|
||||
|
||||
|
||||
## Zsh
|
||||
~/.zshrc:
|
||||
if: '[ $SHELL == "/bin/zsh" ]'
|
||||
path: zsh/zshrc
|
||||
~/.zprofile:
|
||||
if: '[ $SHELL == "/bin/zsh" ]'
|
||||
path: zsh/zprofile
|
||||
|
||||
## Git
|
||||
~/.git:
|
||||
if: '`command -v git >/dev/null 2>&1`'
|
||||
path: git
|
||||
|
||||
# - create:
|
||||
# - ~/downloads
|
||||
|
18
google/gcommands
Normal file
18
google/gcommands
Normal file
@ -0,0 +1,18 @@
|
||||
check_envs(var) {
|
||||
local command="$2"
|
||||
|
||||
if [[ -z "${!env_var}" ]]; then
|
||||
read -rp "Enter value for $env_var: " "${env_var}"
|
||||
export "$env_var=${!env_var}" #Export the variable to be accessible by child processes
|
||||
fi
|
||||
|
||||
if [[ -n "${!env_var}" ]]; then
|
||||
eval "$command"
|
||||
else
|
||||
echo "Environment variable $env_var is not set. Command not executed."
|
||||
fi
|
||||
}
|
||||
|
||||
# Example usage:
|
||||
# run_with_env MY_API_KEY "curl -H \"Authorization: Bearer $MY_API_KEY\" https://api.example.com"
|
||||
# run_with_env DATABASE_URL "psql $DATABASE_URL -c 'SELECT * FROM users;'"
|
82
google/google_rc
Normal file
82
google/google_rc
Normal file
@ -0,0 +1,82 @@
|
||||
_display_bug_machine_info() {
|
||||
local output=""
|
||||
local separator=" | " # Define the separator
|
||||
|
||||
# Check if BUG is set and non-empty
|
||||
if [ -n "$BUG" ]; then
|
||||
# Format BUG value (Cyan) - REMOVED "BUG: " label
|
||||
printf -v output "\e[0;36mB:%s\e[0m" "$BUG"
|
||||
fi
|
||||
|
||||
# Check if MACHINE is set and non-empty
|
||||
if [ -n "$MACHINE" ]; then
|
||||
local machine_part=""
|
||||
# Format MACHINE value (Magenta) - REMOVED "MACHINE: " label
|
||||
printf -v machine_part "\e[0;35mM:%s\e[0m" "$MACHINE"
|
||||
|
||||
# If BUG was also set (output is not empty), add separator first
|
||||
if [ -n "$output" ]; then
|
||||
output+="$separator$machine_part"
|
||||
else
|
||||
# Otherwise, MACHINE is the first/only part
|
||||
output="$machine_part"
|
||||
fi
|
||||
fi
|
||||
|
||||
# If the combined output string is not empty, print it
|
||||
if [ -n "$output" ]; then
|
||||
echo "$output" # echo adds the needed newline after the combined string
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
if [[ ! "$PROMPT_COMMAND" =~ _display_bug_machine_info_bash ]]; then
|
||||
# Prepend the function call
|
||||
PROMPT_COMMAND="_display_bug_machine_info${PROMPT_COMMAND:+;}${PROMPT_COMMAND}"
|
||||
fi
|
||||
|
||||
|
||||
## Aliases ##
|
||||
|
||||
alias batool'=/google/data/ro/projects/bandaid/batool'
|
||||
alias pancetta='/google/bin/releases/bandaid-team/pancetta_par/pancetta.par'
|
||||
alias safergcp='/google/bin/releases/safer-gcp/tools/safergcp'
|
||||
alias clients='g4 clients -u $USER|awk -F: '\''{print $2}'\'''
|
||||
alias g3='cd experimental/users/${USER}/'
|
||||
alias health_check='admin_session --reason=$BUG --tonic_policy=common-loas-transact-dat --transact --delegates=mdbuser/bandaid-batool-server,mdbuser/cloud-control2-gdchardware-frontend -- /google/data/ro/projects/bandaid/batool gdc health_check --justification=$BUG gmec-$MACHINE'
|
||||
|
||||
alias admin_batool='admin_session --reason=$BUG --tonic_policy=common-loas-transact-dat --transact --delegates=mdbuser/bandaid-batool-server,mdbuser/cloud-control2-gdchardware-frontend -- /google/data/ro/projects/bandaid/batool'
|
||||
|
||||
alias connectivity='admin_session --reason=$BUG --tonic_policy=common-loas-transact-dat --transact --delegates=mdbuser/bandaid-batool-server,mdbuser/cloud-control2-gdchardware-frontend -- /google/data/ro/projects/bandaid/batool gdc check connectivity gmec-$MACHINE'
|
||||
|
||||
alias machine_enable='admin_session --reason=$BUG --tonic_policy=common-loas-transact-dat --transact --delegates=mdbuser/bandaid-batool-server,mdbuser/cloud-control2-gdchardware-frontend -- /google/data/ro/projects/bandaid/batool gdc machine enable --env=prod --justification=$BUG --disable_claim=$BUG gmec-$MACHINE'
|
||||
|
||||
alias con='admin_session --reason=$BUG --tonic_policy=common-loas-transact-dat --transact --delegates=mdbuser/bandaid-batool-server,mdbuser/cloud-control2-gdchardware-frontend -- ssh gmec-$MACHINE'
|
||||
|
||||
alias admin='admin_session --reason=$BUG --tonic_policy=common-loas-transact-dat --transact --delegates=mdbuser/bandaid-batool-server,mdbuser/cloud-control2-gdchardware-frontend -- '
|
||||
|
||||
alias gdcgrants='grants add --reason=$BUG cloud-gmec-batool-prod-rw-acl:20h cloud-kubernetes-edge-producer-api-admin-prod:20h gdchardwaremanagement-internal-admin-prod:20h cloud-gmec-bandaid-prod-riker-acl:20h'
|
||||
|
||||
alias gcsec='gcert -m=cloud-gmec-offnet --s --reason=$BUG --use_secondary_key --ua_ca_instance=prod --noloas2 --nocorpssh'
|
||||
|
||||
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
|
||||
#batool() { /google/data/ro/projects/bandaid/batool "$@"; }
|
||||
#pancetta() { bash /google/bin/releases/bandaid-team/pancetta_par/pancetta.par "$0"; }
|
||||
riker() { /google/data/ro/projects/bandaid/riker "$0"; }
|
||||
# Function to display BUG and MACHINE info above the Bash prompt
|
||||
|
||||
|
||||
gdc() {
|
||||
for arg in "$@"; do
|
||||
if [[ "$arg" =~ ^(b\/[0-9]+|shax\/[0-9]+|irm\/i_[0-9a-Z]+) ]]; then
|
||||
BUG="$arg"
|
||||
elif [[ "$arg" =~ ^gmec- ]]; then
|
||||
MACHINE="$arg"
|
||||
fi
|
||||
done
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
declare -A alias_list=(
|
||||
|
||||
# ZSH
|
||||
[ll]='ls -alF'
|
||||
[ls]='ls -lah --color'
|
||||
[grep]='grep --color=auto'
|
||||
[vi]='nvim'
|
||||
[lpg]='cd ~/git/lucidpoint'
|
||||
[ppg]='cd ~/git/personal'
|
||||
[downloads]='cd ~/Downloads'
|
||||
[desktop]='cd ~/Desktop'
|
||||
[docs]='cd ~/Documents'
|
||||
[pip]='pip3'
|
||||
[python]='python3'
|
||||
|
||||
# PYTHON
|
||||
[act]='source venv/bin/activate'
|
||||
[p]='ipython'
|
||||
[dea]='deactivate'
|
||||
|
||||
# GIT
|
||||
[gaa]='git add --all'
|
||||
[gcm]='git commit --all --message'
|
||||
[glo]='git log --oneline --decorate --graph --all'
|
||||
[gl]='git pull'
|
||||
[gp]='git push'
|
||||
[gpd]='git push --dry-run'
|
||||
[gpv]='git push --verbose'
|
||||
[grb]='git rebase'
|
||||
[grv]='git remote --verbose'
|
||||
[gs]='git show --pretty=short'
|
||||
[gst]='git status --short'
|
||||
[gss]='git status --long --show-stash'
|
||||
[gd]='git diff'
|
||||
[gdca]='git diff --cached'
|
||||
[gdcw]='git diff --cached --word-diff'
|
||||
[gds]='git diff --staged'
|
||||
[gdw]='git diff --word-diff'
|
||||
|
||||
# SSH
|
||||
[ed]='ssh errol@edesktop.sancaktar.net'
|
||||
[fs]='ssh errol@fs1.sancaktar.net'
|
||||
|
||||
# KUBERNETES
|
||||
[k]='kubectl'
|
||||
[kgc]='kubectl config get-contexts'
|
||||
[kuc]='kubectl config use-context'
|
||||
|
||||
|
||||
# TERRAFORM
|
||||
[t]='tofu'
|
||||
|
||||
# GCLOUD
|
||||
[gcl]='gcloud config configurations list'
|
||||
[gca]='gcloud config configurations activate'
|
||||
|
||||
|
||||
# SPOTIFY
|
||||
[spo]='spotify_player'
|
||||
|
||||
)
|
||||
|
||||
|
||||
# Alias Functions
|
||||
|
||||
gc() {
|
||||
git add --all
|
||||
if [ -n "$1" ]
|
||||
then
|
||||
git commit --all --message "$1"
|
||||
else
|
||||
git commit -m update
|
||||
fi
|
||||
git push --verbose
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# Alias Loop
|
||||
if [[ -d '/proc' ]]; then
|
||||
current_shell=`cat /proc/$$/comm`
|
||||
else
|
||||
current_shell=`echo $SHELL | cut -d/ -f3`
|
||||
fi
|
||||
|
||||
#Bash
|
||||
if [[ "$current_shell" == 'bash' ]]; then
|
||||
for alias_def in "${!alias_list[@]}"; do
|
||||
alias $alias_def="${alias_list[$alias_def]}"
|
||||
done
|
||||
fi
|
||||
if [[ "$current_shell" == 'zsh' ]]; then
|
||||
#Zsh
|
||||
for alias_def in "${(k@)alias_list[@]}"; do
|
||||
alias $alias_def="${alias_list[$alias_def]}"
|
||||
done
|
||||
fi
|
1
path
Symbolic link
1
path
Symbolic link
@ -0,0 +1 @@
|
||||
/usr/local/google/home/esancakt/dotfiles/bash/bash_completion.d
|
@ -1 +0,0 @@
|
||||
Subproject commit aa59077c635ab21b251bd8cb4dc24c415e64a58e
|
@ -1 +0,0 @@
|
||||
Subproject commit 243704b048668fa0dcf34ebd4857fe8e9500e88a
|
@ -1 +0,0 @@
|
||||
Subproject commit 1547f18083ead1b235680aa5f98427ccaf5beb21
|
@ -1 +0,0 @@
|
||||
Subproject commit 4e37358be51b22078e9361fd6ad0ae199cf03587
|
@ -1 +0,0 @@
|
||||
Subproject commit 763d0a852e6703ce0f5090a508330012a7e6788e
|
@ -1 +0,0 @@
|
||||
Subproject commit 071a9774861a61fc86b687b06cb208e0f2d3ac2b
|
@ -1 +0,0 @@
|
||||
Subproject commit 1f419775caf136a60aac8e3a269b51ad10b51eb6
|
@ -1 +0,0 @@
|
||||
Subproject commit acfd36e4fcba99f8310a7dfb432111c242fe7392
|
@ -1 +0,0 @@
|
||||
Subproject commit 99469c4a9b1ccf77fade25842dc7bafbc8ce9946
|
Loading…
Reference in New Issue
Block a user