made some install scripts and a local copy of python

This commit is contained in:
Brendan McDevitt 2016-10-16 07:41:03 -05:00
parent 6401c1ea67
commit 8152e56503
6 changed files with 79 additions and 3 deletions

3
.bash_aliases Normal file
View file

@ -0,0 +1,3 @@
# aliases
alias ll='ls -lah'

View file

@ -86,3 +86,29 @@ swap_sum()
# this will grab swap usage and each program using swap and total it. # 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 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
}

5
.env
View file

@ -1,7 +1,6 @@
# Enviroment Variables # Enviroment Variables
# Path variable
export PATH=$PATH:$HOME/bin export PATH=$PATH:$HOME/bin
# Bash prompt color - green
export PS1="\e[0;32m[\u@\h \W]\$ \e[m " export PS1="\e[0;32m[\u@\h \W]\$ \e[m "
export EDITOR=vim

17
install.sh Executable file
View file

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

3
install/pip.sh Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
# this will install common libraries in pip

28
install/python.sh Executable file
View file

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