Last active
February 7, 2020 19:14
-
-
Save ShreeMandadi/73344 to your computer and use it in GitHub Desktop.
bash < <( curl -L https://raw.github.com/gist/73344/rcsetup )
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
# This File is maintained on GITHUB | |
# Please edit only at http://gist.github.com/73344 | |
# Setup File at wget http://gist.github.com/raw/73344/.rcsetup | |
# Shree Mandadi.. | |
# RVM Aliases | |
alias ruby='rvm ruby' | |
alias rake='rvm rake' | |
alias gem='rvm gem' | |
#Custom Aliases | |
alias ll='ls -l' | |
alias la='ls -A' | |
alias l='ls -CF' | |
alias ..='cd ..' | |
alias h='history' | |
alias j='jobs -l' | |
alias which='type -a' | |
alias path='echo -e ${PATH//:/\\n}' | |
alias gitup=`find . -name .git -type d | xargs -n1 -P4 -I% git --git-dir=% --work-tree=%/.. remote update -p` | |
alias paef='ps -ae -o pid,user,%cpu,%mem,etime,args --cols 80 | grep -v "\[*\]$" | grep -v "ps -ae" | grep -v "\-bash" |grep -v "grep -v"' |
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
# This File is maintained on GITHUB | |
# Please edit only at http://gist.github.com/73344 | |
# Setup File at wget http://gist.github.com/raw/73344/.rcsetup | |
# Shree Mandadi.. | |
# cd relative to the current Git | |
cdg () | |
{ | |
[[ ! -z $(which git 2> /dev/null) ]] && [[ $(git status 2> /dev/null) ]] && cd "./$(git rev-parse --show-cdup)/$1" | |
} | |
up() | |
{ | |
dir="" | |
if [ -z "$1" ]; then | |
dir=.. | |
elif [[ $1 =~ ^[0-9]+$ ]]; then | |
x=0 | |
while [ $x -lt ${1:-1} ]; do | |
dir=${dir}../ | |
x=$(($x+1)) | |
done | |
else | |
dir=${PWD%/$1/*}/$1 | |
fi | |
cd "$dir"; | |
} | |
function swap() # Swap 2 filenames around, if they exist | |
{ | |
local TMPFILE=tmp.$$ | |
[ $# -ne 2 ] && echo "swap: 2 arguments needed" && return 1 | |
[ ! -e $1 ] && echo "swap: $1 does not exist" && return 1 | |
[ ! -e $2 ] && echo "swap: $2 does not exist" && return 1 | |
mv "$1" $TMPFILE | |
mv "$2" "$1" | |
mv $TMPFILE "$2" | |
} | |
function extract() # Handy Extract Program. | |
{ | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xvjf $1 ;; | |
*.tar.gz) tar xvzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) unrar x $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xvf $1 ;; | |
*.tbz2) tar xvjf $1 ;; | |
*.tgz) tar xvzf $1 ;; | |
*.zip) unzip $1 ;; | |
*.Z) uncompress $1 ;; | |
*.7z) 7z x $1 ;; | |
*) echo "'$1' cannot be extracted via >extract<" ;; | |
esac | |
else | |
echo "'$1' is not a valid file" | |
fi | |
} | |
function ii() # Get current host related info. | |
{ | |
echo -e "\nYou are logged on $HOSTNAME" | |
echo -e "\nAdditionnal information: " ; uname -a | |
echo -e "\nUsers logged on: " ; w -h | |
echo -e "\nCurrent date : " ; date | |
echo -e "\nMachine stats : " ; uptime | |
echo -e "\nMemory stats : " ; free myip 2>&- ; | |
echo -e "\nLocal IP Address :" ; myip | |
echo -e "\nOpen connections : "; netstat -pan --inet; | |
echo | |
} |
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
# This File is maintained on GITHUB | |
# Please edit only at http://gist.github.com/73344 | |
# Setup File at wget http://gist.github.com/raw/73344/.rcsetup | |
# Shree Mandadi.. | |
# If not running interactively, don't do anything | |
[ -z "$PS1" ] && return | |
umask 027 | |
ulimit -S -c 0 # Don't want any coredumps. | |
set -o notify | |
set -o noclobber | |
set -o ignoreeof | |
set -o nounset | |
# Enable options: | |
shopt -s cdspell | |
shopt -s cdable_vars | |
shopt -s checkhash | |
shopt -s checkwinsize | |
shopt -s sourcepath | |
shopt -s no_empty_cmd_completion | |
shopt -s cmdhist | |
shopt -s histappend histreedit histverify | |
shopt -s extglob # Necessary for programmable completion. | |
# Disable options: | |
shopt -u mailwarn | |
unset MAILCHECK # Don't want my shell to warn me of incoming mail. | |
# don't put duplicate lines in the history. See bash(1) for more options | |
# ... or force ignoredups and ignorespace | |
HISTCONTROL=ignoredups:ignorespace | |
# External .bashrc definitions. | |
if [ -f ~/.bash_aliases ]; then | |
. ~/.bash_aliases | |
fi | |
if [ -f ~/.bash_functions ]; then | |
. ~/.bash_functions | |
fi | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" |
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
#!/bin/bash | |
# This File is maintained on GITHUB | |
# Please edit only at https://gist.github.com/gists/73344/edit | |
# Shree Mandadi.. | |
cd | |
rm -f ~/.bashrc | |
rm -f ~/.bash_aliases | |
rm -f ~/.bash_functions | |
mkdir -p ~/scripts | |
curl -L https://gist.githubusercontent.com/ShreeMandadi/73344/raw/.bashrc -o ~/.bashrc | |
curl -L https://gist.githubusercontent.com/ShreeMandadi/73344/.bash_aliases -o ~/.bash_aliases | |
curl -L https://gist.githubusercontent.com/ShreeMandadi/73344/.bash_functions -o ~/.bash_functions | |
chmod 600 ~/.bash* | |
source ~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment