Adds brew to PATH and adds is_online function

This commit is contained in:
William Carroll 2016-08-01 14:01:51 -04:00
parent 792c690e0d
commit 3306754932
6 changed files with 57 additions and 35 deletions

View file

@ -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

View file

@ -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
}

View file

@ -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
}

5
install.sh Normal file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
# install brew and its packages
. ./install_brew.sh

21
install_brew.sh Executable file
View file

@ -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

View file

@ -1,9 +0,0 @@
#!/usr/bin/env bash
pushd "$HOME/pc_settings"
# install brew dependencies
cat ./brew_packages.txt | xargs brew install
popd