diff --git a/.bash_profile b/.bash_profile index b72e72584..cf03d3a6f 100644 --- a/.bash_profile +++ b/.bash_profile @@ -1,17 +1,21 @@ -# bash profile settings for William Carroll +export PATH=$HOME/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:$PATH -# welcome message -echo "Hello, welcome back, William" -# change bash prompt -PS1='$ ' +echo "Welcome back, $USER" -# input mode to Vi +# use vi bindings for terminal input set -o vi -# shortcuts -alias h="history" -alias vi="vim" -alias c="clear" +# aliases +source $HOME/pc_settings/.w_aliases.sh + +# functions +source $HOME/pc_settings/.w_functions.sh + +# run cmatrix command for 3 seconds before exiting +#. $HOME/pc_settings/.matrix_intro.sh + +# syntax highlighting for CLI; if not installed, run the following command +# brew install zsh-syntax-highlighting +source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -export EDITOR=/usr/bin/vim diff --git a/.misc_functions.sh b/.misc_functions.sh deleted file mode 100644 index e775c2a89..000000000 --- a/.misc_functions.sh +++ /dev/null @@ -1,13 +0,0 @@ -# download files to /tmp directory -function wdownload { - URL="$1" - FILENAME="$(basename $URL)" - - wget -O /tmp/"$FILENAME" $URL >/dev/null && open /tmp && echo "Downloaded to: /tmp/$FILENAME" || echo "Error ..." -} - -# spell checker -function wspcheck { - if [ $# -ge 1 -a -f "$1" ] && input="$1" || input="-" - cat "$input" | tr '[:upper:]' '[:lower:]' | tr -cd '[:alpha:]_ \n' | tr -s ' ' '\n' | sort | comm -23 - ~/english_words.txt -} diff --git a/.w_functions.sh b/.w_functions.sh index e1a76bd3f..071289e46 100644 --- a/.w_functions.sh +++ b/.w_functions.sh @@ -1,4 +1,4 @@ -functon npms() { +npms() { clear; npm start; } @@ -10,7 +10,7 @@ source $HOME/pc_settings/.js_to_bash.sh source $HOME/pc_settings/.git_functions.sh # custom bash helpers functions -source $HOME/pc_settings/.misc_functions.sh +# source $HOME/pc_settings/.misc_functions.sh # generates placeholder content for FE work function lorem { @@ -29,3 +29,17 @@ function wsearchpath { echo $PATH | tr ':' '\n' | xargs -I {} find {} -type f -perm +111 -maxdepth 1 -name "*${1}*" -print | xargs basename } + +# tests an internet connection +function is_online { + wget -q --spider "http://google.com" + + if [ $? -eq 0 ]; then + echo "Online" + return 0 + else + echo "Offline" + return 1 + fi +} + diff --git a/install.sh b/install.sh new file mode 100644 index 000000000..302245f14 --- /dev/null +++ b/install.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# install brew and its packages +. ./install_brew.sh + diff --git a/install_brew.sh b/install_brew.sh new file mode 100755 index 000000000..a86f1a155 --- /dev/null +++ b/install_brew.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +echo "Installing Homebrew..." +$(which ruby) -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" +$(which ruby) -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +echo "Homebrew installed." +echo "" + +pushd "$HOME/pc_settings" + +# install brew dependencies +echo "Installing Homebrew packages..." +cat ./brew_packages.txt | xargs brew install +echo "Homebrew packages installed." +echo "" + +echo "Homebrew installed complete!" +echo "" + +popd + diff --git a/install_brew_packages.sh b/install_brew_packages.sh deleted file mode 100755 index 050ff655f..000000000 --- a/install_brew_packages.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -pushd "$HOME/pc_settings" - -# install brew dependencies -cat ./brew_packages.txt | xargs brew install - -popd -