Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint-format-checker.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Bash Lint & Format Check

run-name: ${{ github.actor }} is running ${{ github.workflow }}
on:
push:
branches: [main]
Expand Down
4 changes: 4 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# .shellcheckrc
disable=SC1091
disable=SC1090
disable=SC2034
60 changes: 32 additions & 28 deletions bash/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
*i*) ;;
*) return ;;
esac

# don't put duplicate lines or lines starting with space in the history.
Expand All @@ -34,12 +34,12 @@ shopt -s checkwinsize

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
xterm-color) color_prompt=yes ;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
Expand All @@ -48,42 +48,46 @@ esac
force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi

if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
xterm* | rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
*) ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'

alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
if [ -r ~/.dircolors ]; then
eval "$(dircolors -b ~/.dircolors)" |
else
eval "$(dircolors -b)"
fi

alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'

alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
Expand All @@ -104,16 +108,16 @@ alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
source ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
source /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
source /etc/bash_completion
fi
fi
32 changes: 16 additions & 16 deletions bash/profile
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,44 @@
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
if [ -d "$HOME/bin" ]; then
PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private .local bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
if [ -d "$HOME/.local/bin" ]; then
PATH="$HOME/.local/bin:$PATH"
fi

# load Work profile
if [ -d "/mnt/c/Users" ] ; then
echo 'I am at work'
source "$HOME/.work-profile"
if [ -d "/mnt/c/Users" ]; then
echo 'I am at work'
source "$HOME/.work-profile"
else
echo 'I am not at work!'
echo 'I am not at work!'
fi

# Make cat == batcat (pretty cat)
# relies on batcat being installed (Ubuntu)
# Save the original system `cat` under `rcat`
alias rcat="$(which cat)"
alias rcat='$(which cat)'
# For Ubuntu and Debian-based `bat` packages
# the `bat` program is named `batcat` on these systems
alias cat="$(which batcat)"
alias cat='$(which batcat)'
export MANPAGER="sh -c 'col -bx | batcat -l man -p'"
export MANROFFOPT="-c"

# alias for fd
alias fd=fdfind

alias mk="$(which minikube)"
alias mk='$(which minikube)'

# Docker alias
alias docker-stop='docker stop "$(docker ps -q)"'
Expand All @@ -63,4 +63,4 @@ export GIT_EDITOR=vim
export GREP_OPTIONS='--color=auto' GREP_COLOR='mt=1;32'

# set up eza aliases
source ~/dotfiles/eza/eza-config
source ~/dotfiles/eza/eza-config
37 changes: 18 additions & 19 deletions bash/work-profile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#!/bin/bash

# Java related bits
Expand All @@ -7,7 +6,6 @@ export JAVA_11=/usr/lib/jvm/java-11-openjdk-amd64
export JAVA_17=/usr/lib/jvm/java-17-openjdk-amd64
export JAVA_21=/usr/lib/jvm/java-21-openjdk-amd64


export JAVA_HOME=$JAVA_21
export STUDIO_JDK=$JAVA_21
export JDK_HOME=$JAVA_21
Expand Down Expand Up @@ -44,12 +42,12 @@ alias fbs='cd $FBS'
# Docker clean dangling images <none>:<none>
# from https://projectatomic.io/blog/2015/07/what-are-docker-none-none-images/
function docker-clean() {
docker rmi $(docker images -f "dangling=true" -q)
docker rmi "$(docker images -f "dangling=true" -q)"
}

# Stop all running containers
function docker-stop-all() {
docker stop $(docker ps -q)
docker stop "$(docker ps -q)"
}

alias dsa='docker-stop-all'
Expand All @@ -74,15 +72,15 @@ export KUBECONFIG_INFRA="$HOME/.kubecfg/infra/infra-v2.kubeconfig"
export KUBECONFIG=$KUBECONFIG_DEV

function switch-k8s() {
if [ $1 = 'd' ] ; then
export KUBECONFIG=$KUBECONFIG_DEV
echo "Switch to k8s dev: $KUBECONFIG"
elif [ $1 = 'p' ] ; then
export KUBECONFIG=$KUBECONFIG_PROD
echo "Switch to k8s prod: $KUBECONFIG"
else
echo "Didn't understand chose, k8s is still $KUBECONFIG"
fi
if [ "$1" = 'd' ]; then
export KUBECONFIG=$KUBECONFIG_DEV
echo "Switch to k8s dev: $KUBECONFIG"
elif [ "$1" = 'p' ]; then
export KUBECONFIG=$KUBECONFIG_PROD
echo "Switch to k8s prod: $KUBECONFIG"
else
echo "Didn't understand chose, k8s is still $KUBECONFIG"
fi
}

alias sk='switch-k8s'
Expand All @@ -91,21 +89,22 @@ alias fbs='cd $FBS'

# Just checking
echo "Loaded shodders work profile"
echo "Using kubeconf: $KUBECONFIG \n\n"

echo "Using kubeconf: $KUBECONFIG"

# Set some envs to use with docker (bypassing fba-compose)
export FBA_COMPOSE_DIR=${FBA_COMPOSE_DIR:-/mnt/c/programming/docker-orchestration}
export WINDOWS_HOST=$(ip route show | grep -i default | awk '{ print $3 }')
win_host="$(ip route show | grep -i default | awk '{ print $3 }')"
export WINDOWS_HOST="$win_host"
export REPOS_ROOT_DIR=${REPOS_ROOT_DIR:-~/repos}
export WIN_REPOS_ROOT_DIR=${WIN_REPOS_ROOT_DIR:-/mnt/c/programming}
export WIN_USER_DIR=$(wslpath "$(cmd.exe /c "echo %USERPROFILE%" 2>/dev/null | tr -d '\r')")
win_home_dir="$(wslpath "$(cmd.exe /c "echo %USERPROFILE%" 2>/dev/null | tr -d '\r')")"
export WIN_USER_DIR="$win_home_dir"

# shortcut for running docker compose with correct compose/env files
alias lc='docker compose -f $FBA_COMPOSE_DIR/docker-compose.yml --env-file $FBA_COMPOSE_DIR/.env'

# If using NVM for node version management
# Follow this: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-22-04
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
[ -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
2 changes: 1 addition & 1 deletion bash/zshenv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# for ZIM framework to stop loading auto complete twice - see https://github.com/zimfw/zimfw/wiki/Troubleshooting#completion-is-not-working
skip_global_compinit=1
skip_global_compinit=1
27 changes: 13 additions & 14 deletions bash/zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bindkey -e
#SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '

# Remove path separator from WORDCHARS.
WORDCHARS=${WORDCHARS//[\/]}
WORDCHARS=${WORDCHARS//[\/]/}

# --------------------
# Module configuration
Expand Down Expand Up @@ -64,33 +64,32 @@ ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
# Initialize modules
# ------------------

ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim
ZIM_HOME="${ZDOTDIR:-${HOME}}/.zim"
# Download zimfw plugin manager if missing.
if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then
if (( ${+commands[curl]} )); then
curl -fsSL --create-dirs -o ${ZIM_HOME}/zimfw.zsh \
https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
if [[ ! -e "${ZIM_HOME}/zimfw.zsh" ]]; then
if command -v curl &>/dev/null; then
curl -fsSL --create-dirs -o "${ZIM_HOME}/zimfw.zsh" \
https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
else
mkdir -p ${ZIM_HOME} && wget -nv -O ${ZIM_HOME}/zimfw.zsh \
https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
mkdir -p "${ZIM_HOME}" && wget -nv -O "${ZIM_HOME}/zimfw.zsh" \
https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
fi
fi
# Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated.
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc} ]]; then
source ${ZIM_HOME}/zimfw.zsh init
if [[ ! "${ZIM_HOME}/init.zsh" -nt "${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc}" ]]; then
source "${ZIM_HOME}/zimfw.zsh init"
fi
# Initialize modules.
source ${ZIM_HOME}/init.zsh
source "${ZIM_HOME}/init.zsh"
# }}} End configuration added by Zim Framework install


## Load my standard profile
## Needs to be symlinked `ln -s ~/dotfiles/sh/profile ~/.profile`
source $HOME/.profile
source "$HOME/.profile"

# start Starship
eval "$(starship init zsh)"
# current Startship prompt is: https://starship.rs/presets/gruvbox-rainbow

# Start Zoxide
eval "$(zoxide init zsh)"
eval "$(zoxide init zsh)"
2 changes: 1 addition & 1 deletion eza/eza-config
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ alias tt='eza --tree -L 4 --icons --group-directories-first --header '
alias eld='eza --icons --group-directories-first --only-dirs --header '
alias elf='eza --icons --group-directories-first --only-files --header '

####### EZA CONFIG END #######
####### EZA CONFIG END #######
Loading
Loading