Thursday, May 30, 2013

Mad Money

Most of us Linuxians are big into doing everything from the terminal - software development, computer admin, and general filesystem manipulations. I'm all about whatever extensions, plugins, etc. can make my work in the shell more productive and enjoyable. I've recently switched to zsh from bash and installed the oh-my-zsh extensions, as well as installed some totally kickin' vim plugins for C/C++ development (super awesome stuff).

I've got a neat little script for the shell that will run a ticker-like feed of stock information, gleaned from Yahoo Finance. in the terminal. I like combining it with tmux to create an itty bitty sliver at the base of my screen which spits out all the information. You can check out and download the source on Github.



TODO: The ticker is a wee bit offset from where I'd like it to be; it's a small fix, but one that I've yet to get around to. Additionally, I would like to do all my request polling in a separate thread to prevent any display blocking, as well as provide parameterization for polling options, etc.

Anyways, enjoy!

Wednesday, March 20, 2013

Spring Cleaning

Hello faithful reader(s)!

Though this blog began as a documentation of my foray into digital signal processing, I've decided I would like to continue posting on this site. While the entries I write henceforth may not be related to DSP and audio programming, I may return to the topic in the future.

So, I'd like to begin (again) with a short, neat little script to pimp out your bash prompt on Ubuntu. This configuration will randomly select a word from the Ubuntu dict and provide a definition  at startup of the terminal emulator. Follow these steps to get everything set up:

  1. Ensure that dict is installed, using sudo apt-get -y install dict.
  2. Install sdcv, a command line dictionary. Along with it, download several of the dictionary "packs". You can follow the instructions in this forum post:
    http://askubuntu.com/questions/191125/is-there-an-offline-command-line-dictionary
  3. Add the following lines to your .bashrc:
 random_word=$(sed -n "$(($RANDOM % 99999)) p" /usr/share/dict/words)  
 word=$random_word  
 if [[ $word == *\'s ]]  
 then  
      word=$(echo $word | cut -c-$(echo `expr ${#word} - 2` ))  
 fi  
 export word  
 PS1='[$word]: '  
 echo -e "\033[1;34m$(sdcv -n $word)\033[0;37m"  

That's it! It's not the most robust; sometimes it'll grab a word that can't be defined. Take it, improve upon it, do whatever! Enjoy!

-- End transmission --