Last active
August 27, 2025 04:07
-
-
Save bendog/b55df6d90385e7dd475b12fbb0b1024f to your computer and use it in GitHub Desktop.
Revisions
-
bendog revised this gist
Jun 9, 2025 . 1 changed file with 16 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -103,6 +103,22 @@ HISTSIZE=1000000 SAVEHIST=$HISTSIZE ``` ### ZSH editor defaults Sick of having to remember the `:q!` command to get out of vim? change your default editor! ```shell # Preferred editor for local and remote sessions if [[ -n $SSH_CONNECTION ]]; then # If we're in an SSH session, use nano export EDITOR='nano' else # If we're not in an SSH session, use code export EDITOR='code --wait' fi ``` ### When ready Reopen your terminal, now you should be able to use the auto suggestions and syntax highlighting. -
bendog revised this gist
Jun 9, 2025 . 1 changed file with 19 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -69,14 +69,16 @@ if for some reason you need to re-run your config, you can use this command. ## additional zsh tools ### Download zsh-autosuggestions : git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions ### Download zsh-syntax-higlighting : git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting ### Oh-my-zsh plugins Edit `~/.zshrc` file, find plugins=(git) replace plugins=(git) with : ```shell @@ -89,4 +91,19 @@ plugins=( ) ``` ### ZSH History file length maxium uplift Set the history size of your file to be larger than the default 50k lines/ Find the history section in your ~/.zshrc file and add teh HISTSIZE and SAVEHIST values as below. ```shell # HIST_STAMPS="mm/dd/yyyy" HISTSIZE=1000000 SAVEHIST=$HISTSIZE ``` Reopen your terminal, now you should be able to use the auto suggestions and syntax highlighting. -
bendog revised this gist
May 30, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -26,5 +26,5 @@ glab alias set view 'repo view -w' Add gl alias for glab ```bash echo "\nalias gl='glab'\n" >> $HOME/.aliases ``` -
bendog revised this gist
May 30, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -26,5 +26,5 @@ glab alias set view 'repo view -w' Add gl alias for glab ```bash echo "alias gl='glab'" >> $HOME/.aliases ``` -
bendog revised this gist
May 30, 2025 . 1 changed file with 22 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,30 @@ # Extra tools from homebrew ## some extra tooling which would be good from homebrew brew install aws-cdk aws-sam-cli awscli bat black cmake \ diceware eksctl gh glab httpie iredis isort jq k9s kubernetes-cli \ make openssl pgcli pillow pipx pre-commit rename ruff telnet \ terraform terraform-docs tflint tfsec thefuck trivy vite watch yarn ## congifure git helper apps ### GitHub CLI ```bash gh auth login gh alias set view 'repo view --web' ``` ### GitLab CLI ```bash glab auth login glab alias set view 'repo view -w' ``` Add gl alias for glab ```bash echo "alias gl='glab'" >> ~/.aliases ``` -
bendog revised this gist
May 22, 2025 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -129,4 +129,6 @@ function git_remote_bulk_rename() { alias git-prune='git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d' alias git-fetch-all-branches='for remote in `git branch -r`; do git branch --track ${remote#origin/} $remote; done' ``` -
bendog revised this gist
May 22, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # setting up a Mac with zsh ## install HomeBrew for Mac -
bendog renamed this gist
May 20, 2025 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
bendog revised this gist
May 7, 2025 . 1 changed file with 9 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -23,7 +23,6 @@ fi edit the ~/.aliases file with `code ~/.aliases` and add these lines ```shell # 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)" @@ -40,8 +39,14 @@ alias ls="lsd" alias ll='ls -alF' alias la='ls -A' alias l='ls -CF' # Use eza for tree alias tree='eza --tree --long' # use bat for help docs alias -g -- -h='-h 2>&1 | bat --language=help --style=plain' alias -g -- --help='--help 2>&1 | bat --language=help --style=plain' # mac DNS flush alias flushdnscache='sudo killall -HUP mDNSResponder; sleep 1; echo "macOS DNS Cache Reset"' @@ -62,7 +67,7 @@ function docker_rm_images() { docker rmi $2 $(docker image ls | grep $1 | awk '{print $3}' ) } export PROJECT_DIR="$HOME/Projects" function project() { local sub_dir="$1" @@ -85,6 +90,8 @@ function project() { cd "$dir" } alias pj='project' # Git Tools alias gs='git status' -
bendog revised this gist
Mar 17, 2025 . 2 changed files with 2 additions and 1 deletion.There are no files selected for viewing
File renamed without changes.This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -62,10 +62,11 @@ function docker_rm_images() { docker rmi $2 $(docker image ls | grep $1 | awk '{print $3}' ) } PROJECT_DIR="$HOME/Projects" function project() { local sub_dir="$1" local dir="$PROJECT_DIR/${sub_dir}" echo "$dir" if [[ ! -e "$dir" ]] then -
bendog revised this gist
Mar 6, 2025 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,5 +2,8 @@ some extra tooling which would be good from homebrew brew install aws-cdk aws-sam-cli awscli bat black cmake \ diceware eksctl gh glab httpie iredis isort jq k9s kubernetes-cli \ make openssl pgcli pillow pipx pre-commit rename ruff telnet \ terraform terraform-docs tflint tfsec thefuck trivy vite watch yarn -
bendog revised this gist
Mar 6, 2025 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,6 @@ # Extra tools from homebrew some extra tooling which would be good from homebrew $ brew install aws-cdk aws-sam-cli awscli bat black cmake diceware eksctl gh glab httpie iredis isort jq k9s kubernetes-cli make openssl pgcli pillow pipx pre-commit rename ruff telnet terraform terraform-docs tflint tfsec thefuck trivy vite watch yarn -
bendog revised this gist
Mar 6, 2025 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ some extra tooling which would be good from homebrew $ brew install aws-cdk aws-sam-cli awscli bat black cmake diceware eksctl gh glab httpie iredis isort jq k9s kubernetes-cli make openssl pgcli pillow pipx pre-commit rename ruff telnet terraform terraform-docs tflint tfsec thefuck trivy vite watch yarn -
bendog revised this gist
Mar 6, 2025 . 2 changed files with 9 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,12 @@ # Setup Python ## commands for installing python brew install python brew install pyenv brew install uv poetry ## confirm uv and poetry $ uv --version uv 0.6.4 (Homebrew 2025-03-03) @@ -18,7 +20,7 @@ confirm uv and poetry $ which poetry /opt/homebrew/bin/poetry ## add pyenv settings to ~/.zprofile ```shell cat <<'EOF' >> ~/.zprofile @@ -34,6 +36,8 @@ then run source on that file source ~/.zprofile ## update zsh plugins edit `~/.zshrc` and add **pyenv** and **pipenv** to the plugins ```shell This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ # Setup Git ## install new git tools ```shell -
bendog revised this gist
Mar 6, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ git config --global core.excludesFile ~/.gitignore ## add git lg alias for better git log ```shell cat <<'EOF' >> ~/.gitconfig [alias] lg = lg1 lg1 = lg1-specific --all -
bendog revised this gist
Mar 6, 2025 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -22,9 +22,11 @@ add pyenv settings to ~/.zprofile ```shell cat <<'EOF' >> ~/.zprofile # PyEnv settings export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init --path)" # end of PyEnv settings EOF ``` -
bendog revised this gist
Mar 6, 2025 . 2 changed files with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ confirm uv and poetry add pyenv settings to ~/.zprofile ```shell cat <<'EOF' >> ~/.zprofile export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init --path)" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -86,6 +86,8 @@ function project() { # Git Tools alias gs='git status' # git remote rename function git_remote_rename() { local remote="$1" -
bendog revised this gist
Mar 6, 2025 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -27,6 +27,10 @@ export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init --path)" EOF ``` then run source on that file source ~/.zprofile edit `~/.zshrc` and add **pyenv** and **pipenv** to the plugins -
bendog revised this gist
Mar 6, 2025 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,22 @@ commands for installing python brew install python brew install pyenv brew install uv poetry confirm uv and poetry $ uv --version uv 0.6.4 (Homebrew 2025-03-03) $ which uv /opt/homebrew/bin/uv $ poetry --version Poetry (version 2.1.1) $ which poetry /opt/homebrew/bin/poetry add pyenv settings to ~/.zprofile -
bendog revised this gist
Mar 6, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -44,7 +44,7 @@ Examples can be found here https://www.nerdfonts.com/font-downloads **Note: You may need to restart your mac for these fonts to show up** **WARNING: In your Mac Terminal app, make sure you use a nerd font as your font of choice before you continue** ## install PowerLevel10k -
bendog revised this gist
Mar 6, 2025 . 1 changed file with 6 additions and 42 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -31,57 +31,21 @@ close and reopen the terminal ## install and setup oh-my-zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" ## install nerd fonts I use the example of Meslo Nerd Font, feel free to install one you prefer. Examples can be found here https://www.nerdfonts.com/font-downloads brew search nerd-font # select your fond from that list and install brew install --cask font-meslo-lg-nerd-font **Note: You may need to restart your mac for these fonts to show up** **$${\color(red)WARNING}$$: In your Mac Terminal app, make sure you use a nerd font as your font of choice before you continue** ## install PowerLevel10k -
bendog revised this gist
Mar 4, 2025 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ commands for installing python brew install pyenv brew install uv poetry add pyenv settings to ~/.zprofile @@ -20,8 +20,8 @@ plugins=( # autoswitch_virtualenv aws git pyenv uv zsh-autosuggestions zsh-syntax-highlighting ) -
bendog revised this gist
Mar 4, 2025 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,9 +14,11 @@ if this is zsh go to the next stage, if not check zsh is installed which zsh ### if zsh **is found** go to install oh-my-zsh ### if zsh is **not found**, install with brew following the steps below brew install zsh -
bendog revised this gist
Nov 7, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -95,7 +95,7 @@ ZSH_THEME="powerlevel10k/powerlevel10k" then run source ~/.zshrc if for some reason you need to re-run your config, you can use this command. -
bendog revised this gist
Nov 5, 2024 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,9 @@ ## install new git tools ```shell brew install difftastic ``` ## ignore all .DS_Store files ```shell @@ -18,5 +24,7 @@ cat <<EOF >> ~/.gitconfig lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)' lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)' [diff] external = difft EOF ``` -
bendog revised this gist
Nov 5, 2024 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ #### install fancy helper tools for aliases ```shell brew install lsd eza ``` #### enable .aliases file @@ -40,7 +40,7 @@ alias ls="lsd" alias ll='ls -alF' alias la='ls -A' alias l='ls -CF' alias tree='eza --tree --long' # mac DNS flush alias flushdnscache='sudo killall -HUP mDNSResponder; sleep 1; echo "macOS DNS Cache Reset"' -
bendog revised this gist
Oct 4, 2024 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -51,9 +51,15 @@ ZSH_THEME="agnoster" ## install nerd fonts **Note: these have moved** brew tap homebrew/cask-fonts brew install --force $( brew search font | grep nerd | tr '\n' ' ' ) *Try using just the nerd fonts you actually want* brew install font-meslo-lg-nerd-font **Note: You may need to restart your mac for these fonts to show up** <!-- ## install powerlevel9k - OBSOLETE use powerlevel10k -
bendog revised this gist
Nov 30, 2023 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,8 @@ go to <https://brew.sh> **Note: Be sure to run the commands which brew tells you to run at the end of your brew install!** ## install and setup zsh echo $SHELL @@ -52,6 +54,8 @@ ZSH_THEME="agnoster" brew tap homebrew/cask-fonts brew install --force $( brew search font | grep nerd | tr '\n' ' ' ) **Note: You may need to restart your mac for these fonts to show up** <!-- ## install powerlevel9k - OBSOLETE use powerlevel10k git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k @@ -83,7 +87,11 @@ Now, edit the ZSH_THEME in ~/.zshrc file into : ZSH_THEME="powerlevel10k/powerlevel10k" ``` then run source ~/zshrc if for some reason you need to re-run your config, you can use this command. p10k configure -
bendog revised this gist
Oct 16, 2023 . 2 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes. -
bendog revised this gist
Oct 16, 2023 . 3 changed files with 144 additions and 136 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -110,139 +110,3 @@ plugins=( ``` Reopen your terminal, now you should be able to use the auto suggestions and syntax highlighting. This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,122 @@ # Aliases **Do these in a new terminal window** #### install fancy helper tools for aliases ```shell brew install lsd exa ``` #### enable .aliases file add this line to `~/.zshrc` under the aliases section ```shell if [ -f ~/.aliases ]; then source $HOME/.aliases fi ``` #### add the aliases to the .aliases file edit the ~/.aliases file with `code ~/.aliases` and add these lines ```shell # 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' fi # some more ls aliases alias ls="lsd" alias ll='ls -alF' alias la='ls -A' alias l='ls -CF' alias tree='exa --tree --long' # mac DNS flush alias flushdnscache='sudo killall -HUP mDNSResponder; sleep 1; echo "macOS DNS Cache Reset"' alias randompw='openssl rand -base64 8 |md5 |head -c32;echo' alias tf='terraform' function ports() { netstat -Watnlv | grep LISTEN | awk '{"ps -o comm= -p " $9 | getline procname;colred="\033[01;31m";colclr="\033[0m"; print colred "proto: " colclr $1 colred " | addr.port: " colclr $4 colred " | pid: " colclr $9 colred " | name: " colclr procname; }' | column -t -s "|" } whoseport() { lsof -i ":$1" | grep LISTEN } function docker_rm_images() { docker rmi $2 $(docker image ls | grep $1 | awk '{print $3}' ) } function project() { local sub_dir="$1" local dir="$HOME/projects/${sub_dir}" echo "$dir" if [[ ! -e "$dir" ]] then # if dir doesn't exist prompt to create one echo "Doesn't exist, create a new one? [y/N] " read confirm if [[ ! "$confirm" =~ ^[Yy] ]] then echo "exit" [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell else echo "creating ${dir}" mkdir -p "$dir"; fi fi cd "$dir" } # Git Tools # git remote rename function git_remote_rename() { local remote="$1" local oldname="$2" local newname="$3" echo "$remote:$oldname -> $remote:$newname" if git ls-remote --heads "$remote" \ | cut -f2 \ | sed 's:refs/heads/::' \ | grep -q ^"$newname"$; then echo "Error: $newname already exists" exit 1 fi git push "${remote}" "${remote}/${oldname}:refs/heads/${newname}" ":${oldname}" } function git_remote_bulk_rename() { # usage: git_remote_bulk_rename origin CR feature/ # result: origin:CR-2135 -> origin:feature/CR-2135 local remote="$1" local prefix = "$2" local newprefix = "$3" echo "${remote}:${prefix}... -> ${remote}:${newprefix}${prefix}..." git ls-remote --heads origin \ | cut -f2 | sed 's:refs/heads/::' \ | grep ^"${prefix}.*"$ \ | while read line ; do \ git_remote_rename "${remote}" "${line}" "${newprefix}${line}" ; \ done } alias git-prune='git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d' ``` This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ ## ignore all .DS_Store files ```shell echo ".DS_Store" >> ~/.gitignore git config --global core.excludesFile ~/.gitignore ``` ## add git lg alias for better git log ```shell cat <<EOF >> ~/.gitconfig [alias] lg = lg1 lg1 = lg1-specific --all lg2 = lg2-specific --all lg3 = lg3-specific --all lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)' lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)' EOF ```
NewerOlder