This is a mirror of official site: http://jasper-net.blogspot.com/

The Ultimate Bashrc File

| Sunday, March 13, 2011
Continuing on a Bash theme. If you haven't heard of the "Ultimate Bashrc File", then you should. It's a massive collection of aliases, functions and configuration options for use in your own .bashrc file. The file is maintained by inameiname and is at version 3.31 at the moment, containing a whopping, mind blowing 13K lines of goodness. Using the whole file as is isn't necessarely the best idea, but do go through it and pick up good stuff for your own.

Some of my favorites I've adopted so far below, but really there is so much stuff there that it is impossible to adopt all the good bits over any small period of time.

###### random Cyanide and Happiness comics from explosm.net
function cyanide() { display "$(wget -q http://explosm.net/comics/random/ -O - | grep -Po 'http://www.explosm.net/db/files/Comics/*/[^"]+(png|jpg|jpeg)')"; }
 
##################################################
# Creates a backup of the file passed as  #
# parameter with the date and time  #
##################################################
function bak()
{
  cp $1 $1_`date +%Y%m%d_%H%M%S`
}
(modified slightly to have format in yymmdd_hhmmss)
 
###### roll a single die of "$1" sides, just once
# default number of sides is 6
# written by Dallas Vogels
function roll_die() {
  # capture parameter
  declare -i DIE_SIDES=$1
  # check for die sides
  if [ ! $DIE_SIDES -gt 0 ]; then
    # default to 6
    DIE_SIDES=6
  fi
  # echo to screen
  echo $[ ( $RANDOM % $DIE_SIDES )  + 1 ]
}
 

Read more: Basshero.org

Posted via email from Jasper-net

0 comments: