I'm Brie, a 22 year-old graduate of Slippery Rock University's Computer Science department. My interests include Linux (generally and Ubuntu), networking, BSD-style operating systems including my own, BrieSD, translating English-Spanish-English for open source projects and LAMP configuration. Aside from that, I enjoy photography, making short films and soccer.
Posterous is one of my favorite new(ish) web sites!
brie@briegordon.com
Search
Collatz Conjecture - Python
Using Wikipedia’s pseudocode description of the Collatz Conjecture, I whipped something up in Python. Try it!
n = int(input("What number would you like to explore? "))
while n > 1:
print(n)
if n % 2 != 0:
n = 3*n + 1
else:
n = n/2
print(n)
--
Brie
Sales Tax Calculator - Python
Python is a very cool programming language that I've started learning. It's extremely powerful and I've already done some neat stuff with it. I wrote an interactive sales tax calculator for PA residents. (I'm working on a version that will let you tell me what state you are in and output the information appropriately.
# This is actually the cost of the item and the tax. This would be a ridiculous tax rate.
tax = 1.07
price = raw_input("How much is your item before tax? ")
totalcost = float(price) * float(tax)
finalanswer = round(totalcost, 2)
print finalanswer
Here's a screenshot of how it works:

Internet Explorer FTW
Bet you thought I'd never write that and mean it! So, I got the following straight from the horse's mouth, also referred to as Internet Explorer Platform Preview Guide for Developers[1] in certain circles.
Support for Scalable Vector Graphics (SVG) has become one of the most requested features for implementation in Internet Explorer, and is a powerful way to add attention-grabbing visuals to a website with minimal markup and low bandwidth overhead.
With the Internet Explorer Platform Preview, Microsoft is proud to introduce support for much of the basic SVG feature set, with support for even more expected in future platform pre-releases.
As you may know, I'm a fan of SVG, having spent a lot of time in college writing SVG widgets[2] to recreate form elements in SVG using JavaScript, instructed by the wonderful Dr. David Dailey [3], also known as the man behind "An SVG Primer for Today's Browsers" [4][5] (in cooperation with the W3C, of course).
If you are unfamiliar with what exactly SVG does or you're just new, see this article which will list 9 of a number of reasons why SVG is important for the web. [6]
[1] http://msdn.microsoft.com/en-us/ie/ff468705.aspx
[2] http://techylady.com/svg/widgets.php
[3] http://srufaculty.sru.edu/david.dailey/
[4] http://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html
[5] http://www.sru.edu/pages/15247.asp
[6] http://www.sitepoint.com/blogs/2010/01/08/9-reasons-why-svgs-are-important-for-the-web/
Easily monitor your computer security via Twitter
#!/bin/bashTWEET=`/bin/grep "Failed password" /var/log/auth.log | /usr/bin/tail -n1 | /usr/bin/cut -d"]" -f2` echo $TWEET | /root/tweet.pl
Here is an example of what you'll see. It basically tells you about the last time someone tried to authenticate to your computer using the wrong password, their IP address and what username they tried. You may see duplicates but for something quick and dirty...it works. I'll do what needs to be done to eliminate the duplicates very soon. :-).
--Brie
Programming sites should not throw errors...
“; } if (!empty($error)) { $errorcode = file_get_contents($error_url); $replace = “##error##”; $errorcode = str_replace($replace, $error, $errorcode); echo $errorcode; exit; } $internalfields = array (“submit”, “reset”, “send”, “captcha_code”); $message .= $eol; foreach ($_POST as $key => $value) { if (!in_array(strtolower($key), $internalfields)) { if (!is_array($value)) { $message .= ucwords(str_replace(“_”, ” “, $key)) . ” : ” . $value . $eol; } else { $message .= ucwords(str_replace(“_”, ” “, $key)) . ” : ” . implode(“,”, $value) . $eol; } } } $body = ‘This is a multi-part message in MIME format.’.$eol.$eol; $body .= ‘–’.$boundary.$eol; $body .= ‘Content-Type: text/plain; charset=iso-8859-1′.$eol; $body .= ‘Content-Transfer-Encoding: 8bit’.$eol; $body .= $eol.stripslashes($message).$eol; if (!empty($_FILES)) { foreach ($_FILES as $key => $value) { if ($_FILES[$key]['error'] == 0 && $_FILES[$key]['size'] < = $max_filesize) { $body .= '--'.$boundary.$eol; $body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol; $body .= 'Content-Transfer-Encoding: base64'.$eol; $body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol; $body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol; } } } $body .= '--'.$boundary.'--'.$eol; mail($mailto, $subject, $body, $header); header('Location: '.$success_url); exit; } ?>
They've since fixed the error above.
Their site, which was built with WYSIWYGwebbuilder.com (I kid you not), does not validate. I submitted a request for them to do some programming for me (they don't really mention what kind/language) and I was informed that:
YOUR MESSAGE HAVE BEEN SENT
What was weird is that the site has no advertisements (as of this writing) and their Twitter account, run by one Sébastien Landrieu is not following a million people without any followers yet. The domain name was registered only today:
Creation Date: 22-feb-2010
You're thinking "It's spam...who cares?" and you're right. I don't really care; I just like checking stuff out. Also, I wanted to see how Posterous would handled quoted stuff. :-). --BrieP.S. - Posterous does not like signatures, it seems. What happens if I put content below a more subtle signature? Hmm...
We're awesome and open source software is our idea!
Ways You Can Make Ubuntu Your Idea:
Ubuntu Brainstorm
Launchpad
Community Documentation Ways You Can Make Linux Your Idea:
The Linux Documentation Project
Mailing ListsWays You Can Make FreeBSD Your Idea:
Mailing Lists
Submit a Problem Report
The FreeBSD List of projects and ideas for volunteersEven more goodness:
A huge list of How to Contribute to Open Source without Coding
Microsoft uses the same channels to contribute to the Linux kernel Until next time,Brie
Pretty Pretty Posterous Backgrounds
Posterous is amazingly simple and fun to theme. (Last time, I talked about setting a custom favicon.) That's a nice touch but it's a detail that some will not notice. A custom background, on the other hand, is very noticeable and speaks volumes about you and your blog. Grab an image (may I suggest something from COLOURlovers?) and follow along:
1. Log into your Posterous account.2. Go to Settings > Theme and customize my site
3. Click Advanced
This is where you can put the custom CSS. Note that how it ends up looking will vary based on what kind of customization you have done already. I am using the Ginza bigpic theme. This is what I did, modify as appropriate.
4. Scroll down to the body section that starts out like this:
5. Right before the closing '}' place some lines like this (remove the spaces):
background - repeat: repeat;
6. Click 'Save, I'm done!'
Caution: Some patterns are very bold and may be too distracting for your blog or make the text hard to read.
I've attached several patterns from COLOURlovers.com that I think are really pretty. The links for them are below: [1] http://imgur.com/VTGTy
[2] http://imgur.com/qdIcN
[3] http://imgur.com/1NR2V
[4] http://imgur.com/P9Rog
[5] http://imgur.com/cOpj9the one I'm using:
[6] http://imgur.com/wJLLa P.S. I <3 Posterous. The theming docs are complete and well-written if you're interested in doing more with your Posterous blog.
HOWTO: Custom Favicon for Posterous
1. Log into posterous.com
2. Scroll down and click 'Theme My Site'
3. Click 'Advanced'
4. Click 'Expand'
5. Remove this line:
<link rel="icon" href="/images/favicon.png" type="image/x-png"/>6. Place a line like this where the one you removed was:
<link href="http://www.unixsysadmin.org/favicon.ico" rel="icon" type="image/vnd.microsoft.icon" /> 7. Click 'Save, I'm done!'
8. Click 'OK'You'll be returned to your blog. Note the favicon! :+)!
ISP Trouble? For best results, do this first.
Occasionally, I experience some network latency and packet loss through my ISP, Comcast. When this happens, I let them know about it - and you should, too.
Before you do that, though, there are some things that you should do, as dumb as they may sound. They *will* help you get through to your ISP. Reboot your computer. Reboot your router. Reboot your modem. (For the last two, unplugging the power cable should suffice; don't forget to plug it back in.)Finally, you should gather some data to give them. I like to do this by setting up some pings to places in different geographical locations. I've written a script (tested on Linux and FreeBSD) to get this ping party started. FreeBSD users may have to change the interpreter to #!/usr/local/bin/bash first. Here is the script:#!/bin/bash#### uhoh #### ISP Trouble Script #
# Author: Brie A. Gordon
# brie@unixsysadmin.org
# I run this when I'm having trouble with Comcast. # Replace the line below with the IP of your router.
gnome-terminal -e "ping 10.100.1.1" -t "router" &# Located in Pittsburgh
gnome-terminal -e "ping cmu.edu" -t "pgh" & # My ISP
gnome-terminal -e "ping comcast.com" -t "ISP" &# Located in Australia
gnome-terminal -e "ping news.com.au" -t "australia" & # Located in California
gnome-terminal -e "ping dreamhost.com" -t "california" &#Located in Germany
gnome-terminal -e "ping joker.com" -t "germany" &
Dropbox + Your Web Host can be Friends
That's OK.
Don't want to go through the hassle of compiling Dropbox?
That's OK, too.As long as you were smart enough to choose a web host that allows SSH, I've thought up an easy/lazy way to do this! From your local machine:rsync -e ssh -av yourusername@webhostserver.com:~/ Dropbox/Type your password when prompted then sit back and watch.
(This assumes that the folder you are in on your local computer has a Dropbox folder and that the files you want to back up are in your home folder on your web hosts' server.) Holler at brie@unixsysadmin.org or http://www.unixsysadmin.org/contact.html with your thoughts.

0 Comments