# Read file without empty lines and new line comments with grep
grep -v '^$\|^\s*\#' /path/to/file.txt
# Read file without empty lines, or any comments even on shared lines
sed '/^[[:blank:]]*#/d;s/#.*//;/^$/d' /path/to/file.txt
# Find file name/pattern recusivly through all sub directories
f() { find $2 -name "*$1*"; }
# $ f <Some Pattern> <Path>
# Get full path to the runtime directory, export so the variable
# can be used by child processes
export script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Read simple config file, parse for only the text we need
# (no whitespace, comments..) and exports the values for our script
# and it's child-processes
# Example config:
# config_dir=${some_other_var}/bsdasd
# var_three=3
_config_raw=$(sed '/^[[:blank:]]*#/d;s/#.*//;/^$/d' ${script_dir}/config)
while read -r _cvar; do
export "$(eval echo $_cvar)"
done <<< "$_config_raw"
# Parse i3 keybindings and format them for the user
I3_CONFIG=~/.config/i3
PAGER='less'
alias i3cs='egrep ^bind ${I3_CONFIG}/config | cut -d '\'' '\'' -f 2- \
| sed '\''s/ /\t/'\'' | column -ts $'\''\t'\'' | pr -2 -w 145 -t | $PAGER'
# Helpers for working with Laravel Homestead
alias art="php artisan"
alias gulp="node node_modules/gulp/bin/gulp.js"
function hms() {
pushd "$HOME/Homestead" > /dev/null
vagrant "${@:1}"
popd > /dev/null
}