Advertisement
voodooKobra

My bashrc

May 6th, 2014
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.29 KB | None | 0 0
  1. # Not all of these are original ideas, but these are commands I actually like :)
  2.  
  3. cl()
  4. {
  5.   # change directory then view its contents in one step
  6.   if [ -z $2 ]
  7.   then
  8.     cd $1 && ls -lah
  9.   else
  10.     cd $1 && ls $2
  11.   fi
  12. }
  13.  
  14. fliptable() {
  15.   # Taken from https://twitter.com/climagic/status/370595711483514880
  16.   # Example usage:
  17.   # gpg --verify file.sig file || fliptable
  18.   echo "(╯°□°)╯ ┻━┻";
  19. }
  20. function fuck() {
  21.   # Example usage: `fuck you java`
  22.   killall -9 $2;
  23.   if [ $? == 0 ]
  24.   then
  25.     echo
  26.     echo " (╯°□°)╯︵$(echo $2|flip &2>/dev/null)"
  27.     echo
  28.   fi
  29. }
  30.  
  31. banip() {
  32.   if [ -z $1 ]
  33.   then
  34.     echo "Parameter not passed."
  35.   else
  36.     iptables -A INPUT -s $1 -j DROP
  37.     iptables -A OUTPUT -d $1 -j DROP
  38.     echo "$1 banned."
  39.     #If you get an error, switch the comment out below
  40.     #/etc/init.d/iptables save
  41.     iptables-save
  42.   fi
  43. }
  44. #usage: banip XX.XX.XX.XX
  45. # Blocks incoming and outgoing connections to a given IP or subnet
  46.  
  47. function git-branch-name {
  48.   git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3
  49. }
  50. function git-branch-prompt {
  51.   local branch=`git-branch-name`
  52.   if [ $branch ]; then printf " [%s]" $branch; fi
  53. }
  54. PS1="\e[38;5;154m\u@\h\e[0m \[\033[0;36m\]\W\[\033[0m\]\[\033[0;32m\]\$(git-branch-prompt)\[\033[0m\] \$ "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement