-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: first iteration of bash prompt for *nix
- Loading branch information
Deavon M. McCaffery
committed
Aug 19, 2016
0 parents
commit 6b3106e
Showing
24 changed files
with
3,842 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
rm -rRf backup | ||
mkdir -p backup/ssh | ||
|
||
if ! test -f ~/.ssh; then | ||
mkdir -p ~/.ssh | ||
fi | ||
|
||
cp ~/.bash_profile backup/bash_profile | ||
cp -R ~/.ssh/* backup/ssh | ||
|
||
cp -Rf src/* ~/.ssh | ||
cat template > ~/.bash_profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# set globals for colors | ||
export CLR_CLEAR='\033[0m' # DEFAULT COLOR | ||
|
||
export CLR_BLACK='\033[0;30m' # ANSI BLACK (GRAY) | ||
export CLR_RED='\033[0;31m' # ANSI RED | ||
export CLR_GREEN='\033[0;32m' # ANSI GREEN | ||
export CLR_YELLOW='\033[0;33m' # ANSI YELLOW | ||
export CLR_BLUE='\033[0;34m' # ANSI BLUE | ||
export CLR_MAGENTA='\033[0;35m' # ANSI MAGENTA (PURPLE) | ||
export CLR_CYAN='\033[0;36m' # ANSI CYAN | ||
export CLR_WHITE='\033[0;37m' # ANSI WHITE | ||
|
||
export CLR_BRIGHT_BLACK='\033[1;30m' # BRIGHT BLACK (GRAY) | ||
export CLR_BRIGHT_RED='\033[1;31m' # BRIGHT RED | ||
export CLR_BRIGHT_GREEN='\033[1;32m' # BRIGHT GREEN | ||
export CLR_BRIGHT_YELLOW='\033[1;33m' # BRIGHT YELLOW | ||
export CLR_BRIGHT_BLUE='\033[1;34m' # BRIGHT BLUE | ||
export CLR_BRIGHT_MAGENTA='\033[1;35m' # BRIGHT MAGENTA (PURPLE) | ||
export CLR_BRIGHT_CYAN='\033[1;36m' # BRIGHT CYAN | ||
export CLR_BRIGHT_WHITE='\033[1;37m' # BRIGHT WHITE | ||
|
||
export CLR_ROOT_PROMPT=$CLR_RED # COLOR OF THE PROMPT FOR ROOT | ||
export CLR_STAFF_PROMPT=$CLR_BRIGHT_RED # COLOR OF THE PROMPT FOR STAFF | ||
export CLR_USER_PROMPT=$CLR_BRIGHT_BLUE # COLOR OF THE PROMPT FOR USERS | ||
|
||
# enable colors for various commands | ||
export TERM=xterm-256color | ||
export GREP_OPTIONS='--color=auto' | ||
export GREP_COLOR='1;32' | ||
export CLICOLOR=1 | ||
|
||
# other system settings | ||
export EDITOR='nano' | ||
export HISTCONTROL=ignoredubs | ||
export SVN_EDITOR='${EDITOR}' | ||
|
||
# system binds for bash completion | ||
bind "set completion-ignore-case on" # ignore strict case sensitivity | ||
bind "set bell-style none" # turn off audible alerts | ||
bind "set show-all-if-ambiguous on" # show completion with double tap | ||
|
||
# turn on advanced completion | ||
if [ -f /etc/bash_completion ]; then | ||
./etc/bash_completion | ||
fi | ||
|
||
# source scripts | ||
for script in ~/.ssh/scripts/*.sh; do | ||
source $script | ||
done | ||
|
||
# aliases | ||
# -- prompt for overwrites | ||
alias cp='cp -i' | ||
alias mv='mv -i' | ||
alias rm='rm -i' | ||
|
||
# -- DOS-style shortcuts | ||
alias cd..='cd ..' | ||
alias ..='cd ..' | ||
alias ...='cd .. ; ..' | ||
|
||
# -- listing shortcuts | ||
alias ls='ls -G' | ||
|
||
# -- sudo alias (allow other alias extensions to work when sudo-ing) | ||
alias sudo='sudo ' | ||
|
||
# -- special effects | ||
alias colors="set | egrep 'CLR_w*'" | ||
alias myprofile="history | awk '{print \$2}' | awk 'BEGIN{FS=\"|\"}{print \$1}' | sort | uniq -c | sort -n | tail -n 20 | sort -nr" | ||
|
||
alias flushdns='dscacheutil -flushcache; sudo killall -HUP mDNSResponder' | ||
|
||
# shell options | ||
shopt -s checkwinsize # check window size on script exit | ||
shopt -s cdable_vars # enable change directory to a variable value | ||
|
||
# aliases | ||
PATH=$PATH:~/.ssh/aliases | ||
|
||
# play login sound | ||
tlogi 1>&- 2>&- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function add-bookmark() { | ||
# make sure that a bookmark was specified. | ||
if [ -z $1 ]; then | ||
echo USAGE: add-bookmark NAME | ||
echo ' NAME : a title for your bookmark' | ||
else | ||
# make sure we remove any existing bookmark before defining another one. | ||
remove-bookmark $1 silent | ||
local b="$1"=\"`pwd`\" | ||
|
||
echo Adding bookmark: $b | ||
echo $b >> ~/.ssh/scripts/bookmarks.sh | ||
source ~/.ssh/scripts/bookmarks.sh | ||
fi | ||
} | ||
|
||
function mk-bm() { | ||
add-bookmark $@ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
condo="/Volumes/Storage/Users/dmccaffery/Repos/condo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function cls() { | ||
clear | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
function install-dnvm() { | ||
local dnvmpath=~/.dnx/dnvm | ||
local dnvmuri="https://raw.githubusercontent.com/aspnet/Home/dev/dnvm.sh" | ||
local dnvmsh=$dnvmpath/dnvm.sh | ||
|
||
# determine if the dnvm folder exists | ||
if test ! -d "$dnvmpath"; then | ||
# create the dnvm folder | ||
mkdir -p "$dnvmpath" | ||
fi | ||
|
||
# determine if the dnvm script file does not exist | ||
if test ! -f "$dnvmsh"; then | ||
# attempt to download it from curl | ||
local result=$(curl -L -D - "$dnvmuri" -o "$dnvmsh" -# | grep "^HTTP/1.1" | head -n 1 | sed "s/HTTP.1.1 \([0-9]*\).*/\1/") | ||
|
||
# source it if it was successfully retrieved | ||
[[ $result == "200" ]] && chmod ugo+x "$dnvmsh" | ||
fi | ||
} | ||
|
||
# determine if dnvm is avialable | ||
if ! type dnvm >/dev/null 2>&1; then | ||
# install dnvm | ||
install-dnvm 1>/dev/null 2>&1 | ||
|
||
# determine if dnvm now exists in the expected place | ||
if [[ -f ~/.dnx/dnvm/dnvm.sh ]]; then | ||
# add the dnvm folder to path | ||
PATH=$PATH:~/.dnx/dnvm | ||
|
||
# source dnvm | ||
source dnvm.sh | ||
fi | ||
fi | ||
|
||
# update dnvm on a background thead | ||
screen -d -m -S "dnvm update" dnvm update-self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
function flush-dns() { | ||
dscacheutil -flushcache | ||
sudo killall -HUP mDNSResponder | ||
} | ||
|
||
function flushdns() { | ||
flush-dns | ||
} |
Oops, something went wrong.