Hacker News new | ask | show | jobs
by mflower 2713 days ago
These are probably the 3 I find most useful:

Copies the directory of the current git dir into the clipboard.

    which pbcopy &> /dev/null
    if [[ $? -eq 0 ]]; then
        CLIPBOARD_COMMAND="pbcopy"
    fi
    which clip &> /dev/null
    if [[ $? -eq 0 ]]; then
        CLIPBOARD_COMMAND="clip"
    fi

    cpgitdir() {
        GIT_DIR=`git remote show -n origin | grep "Fetch URL" | sed -e "s/  Fetch URL: //"  | tr -d '\n'`
        echo "Copying git dir to clipboard: $GIT_DIR"
        echo $GIT_DIR | tr -d '\n' | $CLIPBOARD_COMMAND
    }
Allows you to split your .bash_profile into multiple .bash_profile files for clarity

    if [[ -d ~/.bash_profile.d ]]; then
        for file in `find ~/.bash_profile.d -type f`; do
            source $file
        done
    fi
Simple calculator

    calc () {
        bc -l <<< "$@"
    }