Weather Underground Script

Since weather.com is ending their free XOAP service conkyForecast will no longer work at the end of this month.

Therefore I wrote a small script to get the temperature and condition from Weather Underground

#!/usr/bin/python
#
# Fetches Weather info from Weather Underground
#
# Usage: ./wundergound.py zipcode
#
# International:
#  * Go to http://www.wunderground.com/
#  * Find your city
#  * Click the RSS icon
#  * Station ID is the number that follows /stations/ in the url
#
#

# Values are either True or False
metric=False
international=False

import sys
import feedparser

def usage():
    print("Usage:")
    if international:
        print("  ./wunderground.py StationID")
    else:
        print("  ./weunderground.py zipcode")
    sys.exit(1)

if not len(sys.argv) == 2:
    usage()

location=sys.argv[1]

if international:
    url="http://rss.wunderground.com/auto/rss_full/global/stations/"
else:
    url="http://rss.wunderground.com/auto/rss_full/"

feed=feedparser.parse(url+location)

if not feed.feed:
    # Assume Error
    print("Error")
    sys.exit(1)

current=feed['items'][0].title

if metric:
    temp=current.split(",")[0].split(":")[1].split("/")[1].strip()
else:
    temp=current.split(",")[0].split(":")[1].split("/")[0].strip()

condition=current.split(",")[1].split("-")[0].strip()

print('%s - %s' % (temp, condition))

 

Example:


$ ./wunderground 11201
69.6F - Clear

I’m using this script for my conky config:

${execi 600 /home/pyther/scripts/wunderground 11201}


HDTV Recording (MPEG2) to DVD

I record an episode of Dateline NBC because one of my family members wanted to see it, but she wasn’t going to be home to catch the episode. After much fooling around I finally got something that worked well.

So I’m tossing this here in hopes I will remember it and that someone else will find it useful.

The recording was in HD at a resolution of 1920×1280.

mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=6000:keyint=18:trell:aspect=16/9:acodec=ac3:abitrate=224:threads=4 -ofps 30000/1001 -o output.mpg input.mpg

And as another note: When you have a 16/9 video and you scale it to 720×480 (4/3) it will show the full frame to the wide screen tv (making the video look correct) or it will be stretched on a fullscreen television if the dvd player is outputting 4/3 letterbox. If the dvd player is outputting in cropped mode it will cut the extra width of and just show you the 4/3 portion.

^^ – This is how I understand the processes. It may be extremely wrong. If it is and you have a better understanding please let me know!



PacketTracer 5.2.1 – Linux

There is a bug with PacketTracer which seems relatively minor but can cause a lot of frustration to users.

Take me for example: I am taking Cisco 3. It has been 2 years since I took Cisco 1 and 2. The first day in class we were given a review packet tracer file to work on. I forgot to save and when I finally remembered it bit me in the but! I went to save my work and PacketTracer crashed! I lost everything.

Issue: PacketTracer 5.2.1 crashes / segfaults on linux when saving files.

Reason: PacketTracer 5.2.1  is built against Qt 4.4.3.  However, it is using the system version of Qt which is likely newer. In my case, I’m using Qt 4.5.3. Many other distributions also use 4.5.3. It appears that there has been a code change between Qt 4.4.3 and 4.4.5; therefore, making 4.4.5 incompatible with PT 5.2.1.

Solution: Have PacketTracer use the qt libs that it ships with.
This  can be accomplished with the use of LD_LIBRARY_PATH and a shell script.

#!/bin/sh

export LD_LIBRARY_PATH="/opt/pt/lib"
/opt/pt/bin/PacketTracer5

Adjust the paths as necessary, save the file, and make it executable.
PT might not look as nice and pretty, but it won’t crash!



RHCT Here I Come!

Well the big day is tomorrow! After spending nearly half a day, yesterday, getting virtualbox to boot RHEL 5.3 and studying today, I pray I am ready.  The catcher with virtualbox was that acpi_io had to be enabled or else the kernel would hang on boot.

I’ll update you guys tomorrow!



New Computer

Well I was not excepting this to come. Let me explain. First my mother’s laptop died, sort of. It would be on AC power and then suddenly switch over to battery power. Because the battery no longer held a long charge ( <5 min), this became problematic. I decided it was best to give my mom my Dell Vostro 1000 laptop and just buy some cheap stuff from newegg. As you may or may not know my desktop at the time was an Atom 1.6ghz. This was enough for normal everyday tasks, but not enough for the occasional Virtual Machine or movie conversion.

$150 for a motherboard, cpu, and a stick of ram sure in the hell beats $400 for a mediocre laptop.  I ordered the parts, but later that night I found out that the sata card on my server stopped working. This meant no more Hard Drives! Needless to say this caused the Linux to crash and it was impossible to bootup again.

So Linux saved the day… It was about 11:00pm and I was getting ready to go to bed. This was when I found out my server’s sata card just died. So I took my Atom desktop, took out the hard drive, and tossed the server’s drive in there. Then with a little bit of file editing (fstab, grub, and inintrd boot image) I had the system back up and running.  So in three hours I had the whole server back online with all its services going. Now lets see that happen with Windows.

Finally, the motherboard, stick of ram, and cpu arrived. To make a long story short, I installed everything into the case that was housing, the now broken, server. Everything was going fine and I installed Arch Linux. I went to run firefox, but had no luck. I was receiving a “Bus Error”. After a quick google and some time on IRC I determined there was a corrupt library installed. Instead of trying to figure out what lib was corrupt I figured it was just easier to reinstall as I didn’t have much setup.

I reinstalled and now everything is working without a hitch. Now for the part you’ve all been waiting for, the specs!

The PSU and case are 4-5 years old, but, hey, they work. Overall this is a pretty nice system. It has more than enough power for what I need it to do. My only complaint with the motherboard is that suspend-2-ram is total trash in Linux. The onboard nvidia graphics are pretty nice too. I can play UT2004 which makes me happy!

I need to replace the power supply as it is very loud! I will probably do this before I go of to college as I doubt my roomate wants to listen to a blaring fan all night long!



Learning Dvorak…

First off I want to say I’m not dead yet!

So I decided to learn how to type with the dvorak keyboard layout. I had tried this once before, but I gave up! Surprisingly I remembered some of the layout. You are suppose to be able to type faster with the dvorak layout and I think I see how this is possible. There are many common words which can be typed only using the middle and top rows. Also the majority of the “letter” keys are typed with the right hand, which is easier for everyone who is right handed.

I started this adventurer a few days ago and to my surprise my typing speed is not all that bad. If I had to guess I’d say I am typing at about 25-30 words a minute right now. I presume that with some more practice I’ll be doing 40-50 words in a few more days.

Overall I am happy with the switch. Hopefully once I become more comfortable I will be able to switch between dvorak and qwerty without a problem.

http://upload.wikimedia.org/wikipedia/commons/2/25/KB_United_States_Dvorak.svg



[rant] Irrelevant/Unrelated replies to Topics

Over the last few weeks I have noticed a lot of replies in the archlinux forums that have nothing to with a given topic.

Take something like this post: http://bbs.archlinux.org/viewtopic.php?id=65023

The OP is having problems getting eth0 to get an ip via dhcp on startup, however the op states that manually running dhcpcd eth0 works without a problem. So I type out a reply, submit it, and I wait for the op’s response. In the meantime someone posts saying:

Are you getting ab IP, but just not connecting to the internet? If so, comment out the following 2 lines in rc.conf:

gateway=”default gw 192.168.0.1″
ROUTES=(!gateway)

The ROUTES=(!gateway) prevents the gateway from being set. Commenting out those two lines aren’t going to do anything! Nothing I tell you, well at least to fix the problem at hand!

and then you get this post:

My guess is that you have to remove the ! from the front of gateway in ROUTES=(!gateway)

That’s what I used to have to do on my old desktop.

Also, be sure that 192.168.0.1 is actually your gateway. If you don’t know you run dhcpcd then run route.

If you have even the most basic concept of networking, you would know that dhcp would pull in the default gw and all the other information such as dns servers. Regardless, this has nothing to do the op’s problem because the op stated that running dhcpcd manually works! Thus you can infer that the correct gateway is being set with dhcp.

(more…)



Training a Dog

For my final, in Intro to Digital Video, we had to create a video and edit it. I didn’t really have anyone that I could get to help me with the video so I ended up filming my mother teaching my dog, Holly, how to rollover. The final thing turned out better than I was expecting!

http://www.youtube.com/watch?v=yuJnCb6ce5A



New Avatar

Well thanks to ghost1227 I now have a new avatar. I was going for something along the lines of a python (snake), because I’ve had a lot of people ask me if my username has to do with python (the coding language). Initially when I first came up with the username I wasn’t even thinking about that!

So here it is, my new avatar:

Pythers Avatar

Don’t I look handsome?



Christmas Eve and I’m still going…

Well it is christmas eve, yay! I’m still going strong. I’ve been working on a website for a client which has been taking a lot of time. I’ve worked the last two days updating the computers at the school. I’ve been working on converting my uncle’s tapes to cds. A side takes about an hour and he has like 15 tapes. I got 5 left!

I got my christmas presents wrapped and they are ready to go for tomorrow. It is raining here, and it is pretty crappy. I’m hoping the weather gets a bit better. Maybe some snow for christmas?