Skip to content

Instantly share code, notes, and snippets.

@hectorcorrea
Last active December 19, 2025 20:18
Show Gist options
  • Select an option

  • Save hectorcorrea/fd56edea3333bec47829 to your computer and use it in GitHub Desktop.

Select an option

Save hectorcorrea/fd56edea3333bec47829 to your computer and use it in GitHub Desktop.
My .bash_profile configuration
PS1="\w \$ "
alias ls='ls -G -la'
# Git aliases
alias st='git status'
alias br='git branch'
alias co='git checkout'
alias lg='git log'
alias df='git diff'
alias grlast='git reset HEAD~1'
alias be='bundle exec'
alias rr='bundle exec rails server'
alias bashconf='code ~/.bash_profile'
alias notes='code ~/src/notes/notes.md'
alias pg='echo "Use: psql -h 127.0.0.1 -U postgres -d development_db -p 54509"'
alias aterm='java -jar ~/src/mediaflux/aterm.jar'
# Don't save duplicate entries in history
export HISTCONTROL=ignoreboth
# Commented PG variables Mar/2025
# PostgreSQL May/2024
# The FLAGS variables are needed for gem install to find the PG libraries
# export PATH="$PATH:/usr/local/opt/postgresql@15/bin"
# export LDFLAGS="-L/usr/local/opt/postgresql@15/lib"
# export CPPFLAGS="-I/usr/local/opt/postgresql@15/include"
# export PKG_CONFIG_PATH="/usr/local/opt/postgresql@15/lib/pkgconfig"
# March/2025
# Recommended to be added to get `psql` on the command line but the one
# installed from Homebrew comes first on the path so we don't need this
# as long as we have it installed via Homebrew too.
# export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
# March/2025 need for PDC Describe to compile sqlite3
export LDFLAGS="-L/opt/homebrew/opt/sqlite/lib"
export CPPFLAGS="-I/opt/homebrew/opt/sqlite/include"
# Homebrew
export HOMEBREW_PREFIX="/opt/homebrew"
export HOMEBREW_CELLAR="/opt/homebrew/Cellar"
export HOMEBREW_REPOSITORY="/opt/homebrew"
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin";
export MANPATH=""
export INFOPATH="/opt/homebrew/share/info:"
# Devbox installation
export PATH="$PATH:/$HOME/.local/bin"
# Version 16 is what I am using since 8/10/2022
export PATH=$PATH:/usr/local/opt/node@16/bin
# Give preference the Go I installed over the one installed
# by homebrew under /usr/local/bin/go
export PATH=/usr/local/go/bin:$PATH
# Lando
export PATH="/Users/correah/.lando/bin:$PATH";
# Stop Apple from telling me that zhs is the new hotness
# Source: https://www.saintlad.com/hide-default-interactive-shell-is-now-zsh-in-terminal-on-macos/
export BASH_SILENCE_DEPRECATION_WARNING=1
# To support CTRL+X + CTRL+E when editing long commands
# https://twitter.com/nixcraft/status/1387475672914747393
export EDITOR=vi
# ======================================================================================
source ~/.bash_profile_secrets
# ======================================================================================
# March/2025
# This didn't work, I had to pass the value directly to ruby-install
# export RUBY_CONFIGURE_OPTS="--disable-install-doc --with-openssl-dir=$(brew --prefix openssl@3)"
#
# This works:
# ruby-install ruby 3.3 -- --with-openssl-dir=/opt/homebrew/opt/openssl@3
# Ruby Version
source /opt/homebrew/opt/chruby/share/chruby/chruby.sh
chruby 3.3.0 # for Tiger Data
# Changes the display of tab (and window) in the Terminal'
# http://thelucid.com/2012/01/04/naming-your-terminal-tabs-in-osx-lion/
# https://gist.github.com/hotwatermorning/711e37777d246f16762d
function tn {
printf "\e]1;${1:-bash}\a" # tab
printf "\e]2;${1:-bash}\a" # window
}
# bundle grep
function bgrep {
if [ -z "$1" ]; then
echo "usage: bgrep text-to-search"
return 1
fi
echo "Searching for $1"
grep -r $1 $(bundle list --paths) .
}
# Checks out a remote branch
function co-remote {
if [ -z "$1" ]; then
echo "usage: co-remote branch-name"
return 1
fi
echo "Checking out remote branch $1"
git checkout --track origin/$1
}
# Switches to the ruby version indicated in .tool-versions
function rv {
chruby `grep ruby .tool-versions | awk '{print $2}'`
ruby --version
}
# Returns the current git branch if we are in a Git repo, empty otherwise.
function git-branch {
git_branch=`git branch --show-current 2>/dev/null`
if [ -z "$git_branch" ]; then
echo ""
else
echo "$git_branch "
fi
}
# I thought I needed this to prevent GitHub from asking for my passphrase
# (https://stackoverflow.com/a/10032655/446681) but turns out editing the
# ssh/config file takes care of it https://stackoverflow.com/a/41576222/446681
#
# eval $(ssh-agent)
#
# This did not quite work so I removed the passphrase from my key.
# ---
# The call to ssh-add is to prevent getting error with Capistrano:
# ```
# net-ssh requires the following gems for ed25519 support:
# * rbnacl (>= 3.2, < 5.0)
# * rbnacl-libsodium, if your system doesn't have libsodium installed.
# * bcrypt_pbkdf (>= 1.0, < 2.0)
# ```
ssh-add -q ~/.ssh/id_rsa
# Ta-da!
cd ~/src
# Include the branch name in the prompt
PS1='$(git-branch)\w \$ '
" https://linuxhint.com/vimrc_tutorial/
syntax on
" If Nerdtree is installed
" https://github.com/preservim/nerdtree
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment