Archive

Archive for 2009

Run Commands on Startup in Fedora

December 13th, 2009

To have commands run at the end of the startup process, add the commands to the /etc/rc.local file.

Linux

LaTeX and BibTeX Search Path

October 22nd, 2009

I often write papers in LaTeX that use the ACM SIG Proceedings Template. Previously, I would put a copy of the LaTeX style file (.sty) in every directory where I had a LaTeX document that used it. Then I discovered I could set an environment variable to automatically have LaTeX search a path for a style file.

The TEXINPUTS environment variable works similar to the PATH environment variable: it is a list of paths where LaTeX should search for necessary class and style dependencies. I created a folder in my home directory where I keep the ACM SIG Proceedings Template LaTeX style file. I set the TEXINPUTS variable in my .bashrc.

There is also a BIBINPUTS environment variable to search for BibTeX files. I have started putting all the references I use in a single file, to avoid having small BibTeX files all over the place. I put my central BibTeX file in the same location as the LaTeX style file and set the BIBINPUTS variable in my .bashrc.

The following few lines in my .bashrc set the two environment variables:

# Include shared LaTeX classes and BibTeX files in path, if LaTeX folder exists
if [ -d "~/latex" ]; then
    export TEXINPUTS=".:~/latex/:"
    export BIBINPUTS=".:~/latex/:"
fi

Linux , ,

Permanently Change Hostname in Fedora

October 20th, 2009

To permanently to change the hostname of a Fedora box, edit the file /etc/sysconfig/network. (You need to be root to change this file.) Modify the HOSTNAME line.

Linux ,

Hearty Chicken Soup

October 17th, 2009

This is a great recipe to make with leftovers. You can make a meal of roast chicken, potatoes, and corn one night, then have soup made from the leftovers as another meal during the week.

Ingredients

  • 2 cups roasted or rotisserie chicken, cut into bite sized pieces
  • 2 cups roasted fingerling potatoes, cut into bite sized pieces
  • 2 cups cooked corn (preferably cut from the cob)
  • 1 can cream of chicken soup
  • 1 cup milk
  • 1 tsp thyme
  • 1 tsp rosemary
  • 1 tsp seasoned salt

Preparation

  1. Cut the roasted or rotisserie chicken and fingerling potatoes into bite sized pieces.
  2. Over low heat, combine the soup and milk. Whisk to mix well.
  3. Add the chicken, potatoes, and corn, and spices, stirring to combine.
  4. Warm over low heat for 25, stirring every 5 minutes. The soup should not boil; turn down the burner if it does.
  5. Serve with crusty rolls or bread.

Recipe serves 2-3. Leftovers can be heated in a microwave on high for 1 minute 30 seconds, stirring halfway through.

Cooking

Mount Windows Share in Linux

October 17th, 2009

To mount a Windows share in Linux, execute the following command:

mount -t cifs //Server/Share -o username=WinUsername,password=WinPassword /mnt/dir

Linux ,

Finding Packages in Ubuntu

September 29th, 2009

In Fedora, I always use yum search to determine the exact name of a package I want to install using yum install. However, in Ubuntu I noticed apt-get does not have any search function. Instead, I needed to use apt-cache search to locate the exact name of a package. Also, it is good practice to run apt-get update prior to using apt-cache search to ensure the latest list of packages is cached on your computer.

(Note that apt-get update is not the same as yum update. apt-get update updates the list of packages, while yum update updates the list of packages and installs the newest version of any updated packages. In Ubuntu, apt-get upgrade will install the newest version of any updated packages.)

Linux ,

Including Code Blocks in LaTeX

September 23rd, 2009

I recently had a need to include a block of C code in a report I was writing in LaTeX. I discovered the listings package provides mechanisms for nicely displaying code. Include the package in your file by placing

\usepackage{listings}

somewhere before your \begin{document}. Wherever you want the block of C code (or code in a multitude of other supported languages) insert

\begin{lstlisting}[language=C,frame=single]
CODE GOES HERE
\end{lstlisting}

You can specify other options besides language and frame. For more details on the package see the LaTex Wikibook.

Linux

Installing Compiz in Fedora 10

September 6th, 2009

To add some pizzaz to my Fedora 10 box, I decided to install Compiz. I mostly followed the instructions under step 21 at http://www.my-guides.net/en/content/view/125/26/1/9/. Here’s what I did step-by-step:

  1. Installed the latest NVidia drivers for my graphics card. (As far as I know, you cannot use the nv driver with Compiz.)
  2. Ran the command
    glxinfo | grep direct

    and got the response

    Direct Rendering: Yes

    confirming my box had the capacity to run Compiz.

  3. Installed the necessary packages (as root) for using Compiz with Gnome.
    yum install ccsm emerald-themes compizconfig-backend-gconf fusion-icon-gtk \
    emerald compiz-fusion compiz-fusion-gnome libcompizconfig compiz-gnome \
    compiz-bcop compiz compizconfig-python compiz-fusion-extras \
    compiz-fusion-extras-gnome
  4. Added a Startup Program in Gnome to auto-start Compiz at login.
    1. Select System > Preferences > Personal > Sessions.
    2. Click Add.
    3. Enter fusion-icon for command.
    4. Enter a name and comment as you prefer. My comment was Compiz Fusion panel applet .
  5. Logged off and logged back in.
  6. Configured my preferences by selecting System > Preferences > Look and Feel > CompizConfig Settings Manager.

Linux , ,

Tab Completion of SSH Hosts

August 28th, 2009

I was tired of having to type full hostnames every time I wanted to SSH to a computer I commonly use. So, I setup tab completion for hostnames when I use SSH or SCP. The process involved only 3 simple steps.

  1. Create a file .hosts in your home directory. In the file, put the hostnames of computers you commonly connect to, one per line.
    Example .hosts file:

    subdomain.domain.com
    computer.domain.com
  2. Add three lines to your .bashrc file:
    HOSTFILE=~/.hosts
    complete -f -A hostname scp
    complete -A hostname ssh
  3. Enter the command
    source ~/.bashrc

    to reload your settings.

Linux , ,

Spicy Peanut Beef & Broccoli

August 27th, 2009

Peanut sauce gives this dish a peanut flavor and a slight kick. The spice is offset by crisp broccoli which adds some color and crunch to the dish.

Ingredients

  • 0.5 lb. boneless beef sirloin
  • 1 Tbsp. olive oil
  • 2 14 oz. cans (optionally, reduced-sodium) beef broth
  • 3 Tbsp. bottled peanut sauce
  • 1/2 box (8 oz) spaghetti or linguine noodles
  • 2 cups broccoli florets
  • Handful sliced almonds

Preparation

  1. Cut the beef sirloin into thin (about 1/8″) strips.
  2. Heat olive oil in a 12″ non-stick skillet over medium heat. Add the beef strips and cook until well done, about 6 minutes.
  3. Add the beef broth and peanut sauce to the skillet. Turn to medium-high heat and bring to a boil.
  4. Add the spaghetti or linguine, broken in half. Boil for 10 minutes.
  5. Add the broccoli and continue cooking for about 3 minutes, or until most of the beef broth has reduced.
  6. Transfer to serving plate and top with sliced almonds.
  7. Recipe serves 2-3. Leftovers can be heated in a microwave on high for 1 minute.

    Recipe based on “Spicy Beef-Noodle Bowl” as published in Better Homes and Gardens.

    Cooking