diff --git a/.bash_aliases b/.bash_aliases new file mode 100644 index 0000000..b8fc4a9 --- /dev/null +++ b/.bash_aliases @@ -0,0 +1,3 @@ +# aliases +alias ll='ls -lah' + diff --git a/.bash_functions b/.bash_functions index ab45ccf..8006d11 100644 --- a/.bash_functions +++ b/.bash_functions @@ -86,3 +86,29 @@ swap_sum() # this will grab swap usage and each program using swap and total it. for dir in $(find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]") ; do pid=$(echo $dir | cut -d / -f 3);prog=$(ps -p $pid -o comm --no-headers|awk '{print $1}'); for swap in $(grep Swap $dir/smaps 2>/dev/null| awk '{print $2}');do let sum=$sum+$swap; done; echo "$prog $sum "|grep -vw 0;sum=0;done|awk '{ swap[$1]+=$2; sum+=$2} END { for (prog in swap) printf("%-15s Swap: %10.1f MiB\n", prog, swap[prog]/1024); } END {printf("Total Swap: %20.1f MiB", sum/1024);}'|sort -n -k3 } + +# Extra many types of compressed packages +# Credit: http://nparikh.org/notes/zshrc.txt +extract() +{ + if [ -f "$1" ]; then + case "$1" in + *.tar.bz2) tar -jxvf "$1" ;; + *.tar.gz) tar -zxvf "$1" ;; + *.bz2) bunzip2 "$1" ;; + *.dmg) hdiutil mount "$1" ;; + *.gz) gunzip "$1" ;; + *.tar) tar -xvf "$1" ;; + *.tbz2) tar -jxvf "$1" ;; + *.tgz) tar -zxvf "$1" ;; + *.zip) unzip "$1" ;; + *.ZIP) unzip "$1" ;; + *.pax) cat "$1" | pax -r ;; + *.pax.Z) uncompress "$1" --stdout | pax -r ;; + *.Z) uncompress "$1" ;; + *) echo "'$1' cannot be extracted/mounted via extract()" ;; + esac + else + echo "'$1' is not a valid file to extract" + fi +} diff --git a/.env b/.env index 1358907..f6d391a 100644 --- a/.env +++ b/.env @@ -1,7 +1,6 @@ # Enviroment Variables -# Path variable export PATH=$PATH:$HOME/bin - -# Bash prompt color - green export PS1="\e[0;32m[\u@\h \W]\$ \e[m " +export EDITOR=vim + diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..817ec0f --- /dev/null +++ b/install.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# inspiration from https://github.com/webpro/dotfiles/blob/master/install.sh +# inspiration from https://medium.com/@webprolific/getting-started-with-dotfiles-43c3602fd789#.jfhvg130r + +# get current dir so script can run from anywhere +export DOTFILES_DIR +DOTFILES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# update dot files by pulling latest repo +[ -d "$DOTFILES_DIR/.git" ] && git --work-tree="$DOTFILES_DIR" --git-dir="$DOTFILES_DIR/.git" pull origin master + +# symlink our dotfiles to our users home dir so they can make use of all the good stuff in it +ln -sfv "$DOTFILES_DIR/.bash_profile" ~ +ln -sfv "$DOTFILES_DIR/.bashrc" ~ + +# pkg managers +. "$DOTFILES_DIR/install/pip.sh" diff --git a/install/pip.sh b/install/pip.sh new file mode 100644 index 0000000..050e9b5 --- /dev/null +++ b/install/pip.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# this will install common libraries in pip + diff --git a/install/python.sh b/install/python.sh new file mode 100755 index 0000000..9f1b081 --- /dev/null +++ b/install/python.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# this will install a local copy of python for the user + +# change the version if you want a different version +# https://www.python.org/downloads/ + +py_version=2.7.12 +download_url=https://www.python.org/ftp/python/2.7.12/Python-${py_version}.tar.xz + +# download the python version and extract it +DOTFILES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +mkdir -p "$DOTFILES_DIR/python" +cd "$DOTFILES_DIR/python" +wget $download_url +tar xvf Python-${py_version}.tar.xz +find "$DOTFILES_DIR/python" -type d -exec chmod 0755 {} \; +cd Python-${py_version} + + +# okay now install it +./configure --prefix=$DOTFILES_DIR/python +make +make install + +# update the users $PATH variable to include the newly installed python binary + +export PATH="$DOTFILES_DIR/python/Python-${py_version}:$PATH" +export PYTHONPATH="$DOTFILES_DIR/python/Python-${py_version}"