my musings 

Facebook Twitter LinkedIn YouTube E-mail RSS
formats

Twitter and menv update

I’ve been a little slow on updating this site but with good reason. I recently was hired by Vyatta (a Brocade company) and I am very excited about the team there. Just as always let me say the postings on this site are my own and don’t necessarily represent Brocade’s positions, strategies or opinions.

In other news I just freshened up my twitter account a bit. I’ve found that often I have quick little posts about a news article or the like which I want to post on here but which don’t really qualify for a full blog post. I’ll be putting those up on twitter from now on.

And of a more interesting nature I pushed out a few updates to menv: my linux environment setup on github. Essentially this is a script that adds bash aliases and setups vim just the way I like it so when I load up a new computer I can get it up and running quickly. I still need to extend it a lot to do things like configure gnome but all in due time.

This latest revision has a number of cool additions. Let me go over a few of them:

The first addition is simple but very useful if you are in networking and need to reference RFCs a lot:


  menv_function rfc
  function rfc {
    if [[ $2 == "-l" ]] ; then
      lynx http://tools.ietf.org/html/rfc$1
    else
      if [ ! -d ~/rfc/ ]; then
        mkdir ~/rfc/
      fi

      if [ ! -f ~/rfc/$1.txt ]; then
        wget -q http://tools.ietf.org/rfc/rfc$1.txt -O ~/rfc/$1.txt
        if [[ $? != 0 ]]; then
          echo $?
          /bin/rm -f ~/rfc/$1.txt
        fi
      fi

      if [ -f ~/rfc/$1.txt ]; then
        cat ~/rfc/$1.txt | less
      else
        echo "RFC Not Found"
      fi
    fi
  }

As you can see this function works from the command line where you can type something like ‘rfc 6905′ or rfc 6905 -l’. The first will download a copy of the RFC, caching it, and then pipe it into your pager. If you add the -l option it will open the RFC in lynx (a command line web page viewer). This is just easier in my opinion than opening up your browser and googling for the RFC.

Next I added a menv_remote_install script which allows you to execute it as a remote bash script to install menv onto you system. This makes the install process one line rather than the multi-line process I had before with your wget, chmod +x, etc. I haven’t in fact had a need to execute this script yet so there could still be some bugs in it.

Third, previously I had a great motd message but I found I often wanted some of the information in the motd later in the terminal’s life. Thus there is now a ni/nodeinfo alias which display that information. The motd was also improved to test for connectivity to google and dns.

Please go over to github and checkout the entire diff and the entire menv repo if you have not seen it before. I would love to know what you have in your dotfiles.

Leave a Reply

Your email address will not be published. Required fields are marked *