Archive for the 'Linux' Category

Free Open Source Software in Three Dimensions

Tuesday, August 8th, 2006

It amazes me what things are possible when the software is open and people are free to innovate and implement whatever they want. This is Linux running a special OpenGL driven window manager called compiz. Apple pioneered this idea, but these folks have taken it to the next level. Keep in mind that although Novell created and released this it is open for anyone else to use, modify, and redistribute. It belongs to everyone. Enjoy!


Watch on YouTube

Getting Healthy the Geeky Way

Thursday, June 8th, 2006

Fat man before and after.Let’s face it. I live a pretty sedentary lifestyle and I eat as if I were a linebacker. I was the kind of guy who lost weight on his mission because that was the most exercise I’d ever gotten in my life. I like food. I don’t like exercise. My hobbies include reading, playing video games, and programming. Geocaching is good, but that’s not even close to enough exercise to do me much good. Since getting married I’ve taken to eating two servings worth of everything Krissy and I cook. When I went to see the doctor for a physical his exact words were: “You don’t smoke. You don’t drink alcohol or coffee. You don’t lead a risky lifestyle. Nope… weight will be your nemesis.

My cholesterol is too high and I need to lose weight. Krissy and I attended a class this evening aimed at educating unhealthy people about healthy eating habits specifically geared toward lowering high cholesterol levels. We were given a charge to document all of our food intake in a week and to then compare that to our goals and see where we might improve. They gave us a sheet of paper upon which to track our eating habits. There was no way I was going to let things go on paper where the information would languish in uselessness. When we returned home I immediately set out looking for Free Software to track my food intake and my progress over the next few months.

The first thing I found was Gnutrition. This software looked promising at first. It includes information from the FDA on over five thousand different foods and allows one to track progress and plan meals. Unfortunately the most recent release of the software was in 2001 and I couldn’t even get it to compile. I found a few other applications for nutritional information, but none of them allowed tracking of eating habits, which was what I really wanted.

When I first thought about using my geek talents to get healthy I thought that there ought to be a website that would allow me to keep track of these things no matter where I was so I could hop online and update it. I thought that something like a “Google Diet” sounded like a good idea. I guess I wasn’t the only one that thought that might be a good idea. In searching for Free Software I found a free website called FitDay. FitDay is a free online nutrition and exercise tracking system. It allows setting goals and seeing how much fat, calories, and nutrients are being ingested.

As far as exercise goes, I am a complete novice. I have no clue where to start, what to do, or how long to do it for. For people like me RunFatBoy.net was created. The site’s not quite done yet, but it looks like it’s just what I need to get started and to get my stomach to stop spilling out over my pants.

Getting in shape and healthy may not be fun, but it can be just as geeky as you want it to be. And if you’re me then that’s very geeky indeed.

Skype Video Calling: Cheap As Free

Monday, May 29th, 2006

Skype iconFree for Windows XP users, that is. Skype is software that allows voice to be carried over the internet between two or more participants in a phone-like setting. In other words, it lets you talk to people as if you were talking to them on the phone, but lets you do it for free over the internet to anywhere in the world for free. Skype is released for Windows, Macintosh, and Linux and all three can talk to one another. The video features, however are still in beta and are only available for Windows XP.

Krissy’s brother and his family recently moved to Georgia, so we decided we would try to keep in touch using the new video capabilities in Skype. The audio quality is excellent, but with the limitations in bandwidth imposed by our asynchronous broadband we can only really communicate with the bandwidth of a palty sixty Kilobytes per second. The video quality is less than stellar, and we have experienced dropouts that required us to manually reconnect. The dropouts were probably not Skype related, however.

I am looking forward to using the Linux version when it comes out to talk to them from our place, but I really doubt if we can maintain a three-way video connection with only thirty Kilobytes per second transfer rates. I don’t even know if Skype’s software supports more than two parties using video at once.

While it’s less than perfect and nowhere near as good as being in the same room with your family, it’s still better than talking without video at all, especially for the younger ones that can’t yet really talk a lot. At least they get to see their family and learn who they are even if it’s just the grown-ups talking.

Skype Video Conference

Viruses and Spyware Drive Mom to Consider Alternate OS

Sunday, May 7th, 2006

My Mom called me tonight with a question: how much does it cost to get a legal copy of Windows on my computer? She bought a computer from a guy who builds them for people out of his house. He apparently didn’t inform her that part of the cost-savings in this PC was due to the unpaid Windows Tax.

She is not eligible for an upgrade version and she does not have money to spend on software. I have used Slackware Linux for about three years on all of my machines. She trusts my judgement, and so she asked me what she needed to do to try Linux. I sent her a torrent to download the latest Ubuntu Live CD and told her how she can “test drive” Linux without having to lose any of her settings she’s got now.

She hasn’t had a chance to try it out yet, but she sounds interested. Assessing her needs, Ubuntu seems like a nice fit. I may have to customize it a bit for her so she can watch divx movies and listen to MP3s, but I think she will be happy with her new OS. I’ll update with more information as to how she likes it and what the shortcomings might be.

Record Streaming Audio with Linux: Part II

Friday, March 3rd, 2006

I said I was looking into getting FIFOs working so that the filesize requirements would be reduced. It’s also more efficient this way. I was heavily influenced by the two scripts created by Daniel Howard.

So here’s how it works. You get to create two scripts. The first one is for recording. It’s an all-purpose script that I called record.sh. Here is the code:

#!/bin/bash

#

# record.sh

#

# Use mplayer to capture the stream

# at $STREAM to the file $FILE

#

# example: record.sh my_radio_show 60 mms://someserver.com/stream</p>
<p>DIR=/home/shawn/PodCasts #directory where to save the file

TEMPDIR=/tmp</p>
<p># Don’t edit anything below this line

#######################################################

DATE=`date +%d-%b-%Y`  # Save the date as DD-Mmm-YYYY

YEAR=`date +%Y` # Save just the year as YYYY

NAME=$1

DURATION=$2 # enough to catch the show, plus a bit

STREAM=$3

TEMPFILE=$TEMPDIR/$NAME-$DATE

FILE=$DIR/$NAME-$DATE # Where to save it</p>
<p># Capture Stream

mkfifo $TEMPFILE.wav

mkfifo $TEMPFILE-silenced.wav</p>
<p># The lame settings below are optimized for voice encoding

# The sox command below strips out any silent portions

lame -S -a -m m –ty “$YEAR” –vbr-new -V 9 –lowpass 13.4 –athaa-sensitivity 1 \

    –resample 32 $TEMPFILE-silenced.wav $FILE.mp3 >/dev/null &

sox $TEMPFILE.wav -c 1 $TEMPFILE-silenced.wav \

    silence 1 0.2 0.5% -1 0.2 0.5% >/dev/null&

/usr/bin/mplayer -quiet -cache 500 \

    -ao pcm:file=”$TEMPFILE.wav” -vc dummy -vo null \

    -noframedrop $STREAM >/dev/null&</p>
<p>sleep 5

# get the pid of all processes started in this script.

PIDS=`ps auxww | grep $TEMPFILE | awk ‘{print $2}’`</p>
<p># the & turns the capture into a background job

sleep `echo ${DURATION}*60 | bc`  # wait for the show to be over

kill $PIDS # kill the stream capture

rm $TEMPFILE.wav

rm $TEMPFILE-silenced.wav

This script takes three args:

  1. the name of the show you’re recording. This will be used in the final filename with the current date appended.
  2. the length of the show in minutes
  3. the URI of the stream (often mms:// or http://)

This integrates very well with another script that will hold all the data for the shows we want to record and automatically set the start times for us. Here is my script that I called today.sh

#!/bin/sh

#

# today.sh — schedule what programs you want to rip today using the

# recorder script.</p>
<p># Non-obvious paths

RECORDER=$HOME/bin/record.sh

RECORDER_HI=$HOME/bin/record-hi.sh</p>
<p># Set up stations

KFI=”http://a814.l1977144512.c19771.g.lm.akamaistream.net/D/814/19771/v0001/reflector:44512?MSWMExt=.asf”

WXNT=mms://wmc1.liquidviewer.net/WXNT

WPGB=”http://84.53.144.36:80/D/1046/20063/v0001/reflector:43803?MSWMExt=.asf”

KOZZ=mms://lotusradio-kozz.wm.llnwd.net/lotusradio_kozz</p>
<p># What day is it?

TODAY=`date +%a`</p>
<p># EVERY DAY

#everyday() {}</p>
<p># WEEKDAYS

weekday() {

	# “Record John_Ziegler for three hours, starting at 7:00pm.”

	echo $RECORDER John_Ziegler       180  $KFI | at  7:00pm

	echo $RECORDER Glenn_Beck         180 $WPGB | at  6:00am

}</p>
<p># MONDAY

if [ $TODAY = “Mon” ]; then

	# everyday

	weekday

fi</p>
<p># TUESDAY

if [ $TODAY = “Tue” ]; then

	# everyday

	weekday

fi</p>
<p># WEDNESDAY

if [ $TODAY = “Wed” ]; then

	# everyday

	weekday

fi</p>
<p># THURSDAY

if [ $TODAY = “Thu” ]; then

	# everyday

	weekday

fi</p>
<p># FRIDAY

if [ $TODAY = “Fri” ]; then

	# everyday

	weekday

fi</p>
<p># SATURDAY

if [ $TODAY = “Sat” ]; then

	# everyday

	echo $RECORDER Handel_On_The_Law   300 $KFI | at  6:00am

	echo $RECORDER Dr_Dean_Edell        60 $KFI | at  2:00pm

fi</p>
<p># SUNDAY

if [ $TODAY = “Sun” ]; then

	# everyday

	echo $RECORDER Jesus_Christ_Show   180  $KFI | at  6:00am

	echo $RECORDER Glenn_Beck          180 $WPGB | at 10:00am

	echo $RECORDER_HI Dr_Demento       120 $KOZZ | at 10:00pm

fi

Using this as a template you might notice another script being referred to. record.sh has audio processing optimized for talk radio. For higher quality and stereo, you need to change a few things. You can download all of the scripts mentioned here at the bottom of this post.

To finish off this solution you need to run today.sh at some point after 12:00am and before the start of the earliest program you wish to record. I set mine to run daily at 1:00am.

# Schedule recordings for today from radio streams

0 1 * * * /home/shawn/bin/today.sh >& /dev/null

Downloads:

Record Streaming Audio with Linux: Part I

Tuesday, February 28th, 2006

Update: For a better solution check out this newer post

I happen to enjoy listening to Glenn Beck. The problem is that I can’t receive his weekday shows where I live. Even if I could receive his weekday show over the air, I wouldn’t hear most of it because I am busy working all day.

The solution: cron and mplayer with a little help from sox.

Here’s a sample script:

#!/bin/bash

# Use mplayer to capture the stream

# at $STREAM to the file $FILE</p>
<p>DATE=`date +%d-%b-%Y`  # Save the date as DD-Mmm-YYYY

YEAR=`date +%Y` # Save just the year as YYYY</p>
<p># Where you want the file saved.  Leave off file extension

FILE=/home/shawn/PodCasts/Glenn_Beck_Show_$DATE</p>
<p># The following file should be a playlist file such as .asf or .asx

# You can also create your own file with a URI and put it here

STREAM=/home/shawn/bin/glenn_beck_show-6-9am

DURATION=3.1h # enough to catch the show, plus a bit

#DURATION=200s # a quick run, just for testing</p>
<p># For the id3v2 Tags

AUTHOR=”Glenn Beck”

ALBUM=”104.7 WPGB-FM Pittsburgh”

TITLE=”Glenn Beck Show – $DATE”</p>
<p># Capture Stream

/usr/bin/mplayer -really-quiet -cache 500 \

    -ao pcm:file=”$FILE.wav” -vc dummy -vo null \

    -playlist $STREAM &

# the & turns the capture into a background job

sleep $DURATION  # wait for the show to be over

kill $! # kill the stream capture</p>
<p># remove gaps and convert to mono

sox $FILE.wav -c 1 $FILE-silenced.wav \

     silence 1 -0.9 2% -1 -0.9 2% ;

rm $FILE.wav ; #remove original capture</p>
<p># Encode to .mp3, mono 32kHz 32kb/s, and tag the file

lame -a -m m –tt “$TITLE” –ta “$AUTHOR” \

     –tl “$ALBUM” –ty “$YEAR” –vbr-new -V 9 \

     –resample 32 $FILE-silenced.wav $FILE.mp3 ;

rm $FILE-silenced.wav # Remove the raw audio data file

Once all of the variables have been set, make this executable and make a cron job for it.
crontab -e

Here’s an example for starting at 6am every weekday:

0 6 * * 1-5 /home/shawn/bin/glenn_beck.sh >& /dev/null

Notes

  • The basis for this script is the one found at this Linux Journal article.
  • You need at least SoX version 12.17.9 for the silence filter to work properly.
  • MPlayer should be fairly recent. Older versions have a different syntax for pcm (wav) audio output
  • This solution still requires huge amounts of disk space (~500MB/hour). I am still experimenting with using named pipes (fifos) to do all of the file processing in RAM and only output the final encoded file to the disk.

links for 2006-02-27

Monday, February 27th, 2006

Mine is the Church of Emacs?

Sunday, February 26th, 2006

Written on the chalkboard at the beginning of Elder’s Quorum meeting was the follwing:

  • What is vi?
  • What leads to vi?
  • What are the effects of vi?
  • How do I avoid vi?
  • Do I have vi?
  • How do I get rid of vi?

Which is better, vi or emacs? That is the age old debate among *NIX users. I never thought the Church would establish any doctrine on the matter, and for a minute I was second guessing myself.

As it turns out the teacher was just being lazy and “vi” stood for “vain imaginations.” I think I like my original notion better.

Dell BIOS Updates

Friday, May 27th, 2005

I find it increasingly preposterous that the BIOS updates I want to install are distributed in the form of executables with floppy disc images buried within them. I really would find it a lot more useful if they would allow you to download just the image files. Then I’d be able to use dd on *NIX machines to write floppies.

Of course, this is all rather interesting considering that the laptop I wish to flash to BIOS on doesn’t even have a floppy drive, but that’s another point altogether.