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(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!



[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?



Computer Work

Well amazingly I have had about 5 different computer jobs within the last week and a half. Incredible! It is a lot fun, but I’ve been busy as heck. I should be starting a web dev job which will mainly involve updating the code to make it W3C complaint.



Linux Server – Advance Web Page Design Class

Thats right folks! I will be throwing together a Linux Web Server for my Advance Web Page design class, using one of the school computers.

I plan on installing Fedora Core 9 on it, with apache, php, and mysql, aka a LAMP server. I’m trying to decide weather I should go with ftp or samba shares.

Also I have to figure out how to make it easy for the teacher to maintain and add users to the server after I leave :(