Skip to content

Instantly share code, notes, and snippets.

@hawkup
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hawkup/ce8191be2531e1cce385 to your computer and use it in GitHub Desktop.
Save hawkup/ce8191be2531e1cce385 to your computer and use it in GitHub Desktop.
bashrc file
#http://serverfault.com/questions/3743/what-useful-things-can-one-add-to-ones-bashrc
extract () {
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 "don't know how to extract '$1'..." ;;
esac
else
echo "'$1' is not a valid file!"
fi
}
if [ $(dpkg-query -W -f='${Status}' xclip 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
echo "install xclip for copy and paste";
sudo apt-get install xclip;
fi
alias pbcopy='xclip -selection clipboard';
alias pbpaste='xclip -selection clipboard -o';
sshkey(){
cat ~/.ssh/id_rsa.pub | pbcopy && echo "Copied to clipboard.";
}
#http://stackoverflow.com/questions/9717137/displaying-git-branch-name-in-prompt-does-not-work-in-screen
# Add following line to /.bashrc to show Git branch name in ssh prompt
PS1='\[\033[0;31m\]\w\[\033[0;33m\]$(__git_ps1)\[\e[0m\]$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment