Benjamin W. Smith

Benjamin W. Smith

Benjamin W. Smith  //  Sysadmin by trade, Pythonista by passion. Dad to two boys and a girl. Guitarist. I like my coffee black, just like my metal.

Jul 24 / 10:57am

The Toddl^H^H^H^H^H Childrens Creed..

I am discovering that this creed does not only apply to toddlers.  Pretty much covers most kids up to but not limited to 12 years of age ;)
 
The joys of parenting!

The Toddlers Creed
by Dr. Burton L. White

If I want it, IT'S MINE!

If I give it to you and change my mind later, IT'S MINE!

If I can take it away from you, IT'S MINE!

If it's mine it will never belong to anybody else, no matter what.

If we are building something together, all the pieces are mine!

If it looks just like mine, IT'S MINE!

If it breaks or needs putting away, IT'S YOURS!

 

Filed under  //  MINE MINE MINE   creed   kids   life   toddlers  
Jan 25 / 7:37pm

Tracking personal bandwidth usage.

I’ve been on a major self improvement kick lately. I’ve kicked several crazy habits including, but not limited to:

  • Smoking
  • Biting my nails
  • Soda
  • Sugar (practicing moderation)

Next on my self improvement quest, I decided to start monitoring bandwidth usage and tracking it on my blog so I(and you!) can follow how much I’m using, and try to trim it down to a reasonable level. I’m not going to play around, I am seriously addicted to the internet. It is one of my oldest, hardest to moderate addictions EVER. I figured if I kept track of how much I actually use on a daily basis that it would help me moderate myself.

So, this morning I downloaded and installed vnstat and initialized the database for my single interface like so:

sudo vnstat -u -i eth0

Where eth0 is the interface all my network traffic routes through. To track multiple interfaces, run the above command again, swapping out eth0 for the other interface.

Next I fired up the following cron:

*/5 * * * * if [ -x /usr/bin/vnstat ] && [ `ls /var/lib/vnstat/ | wc -l` -ge 1 ]; then /usr/bin/vnstat -u; fi

It samples usage on any interface you specify every 5 minutes and creates awesome statistics from it. So, whenever I have a quick break between tasks, I run vnstat and get a glimpse at my usage.

Now, this is the part that scared me a bit.. I never really thought about how much I use. I fired all of this up at ~9:00AM, the snapshot below was taken at 10:45AM.

bsmith@bsmith-desktop [10:47:06 (0.17)] ~ 
-> vnstat
Database updated: Tue Jan 26 10:45:01 2010

    eth0

       received:      40.68 MB (81.6%)
    transmitted:       9.89 MB (18.4%)
          total:      50.57 MB

                    rx     |     tx     |  total
    -----------------------+------------+-----------
        today     40.68 MB |    9.89 MB |   50.57 MB
    -----------------------+------------+-----------
    estimated        89 MB |      20 MB |     109 MB

I, um, yeah I use the internet, a lot..

There are lots of other fun things you can do with vnstat, but I’ll mainly just look at incremental snapshots, and the money shot: daily usage.

Daily output looks like this:

bsmith@bsmith-desktop [10:47:41 (0.09)] ~ 
-> vnstat -d

eth0  /  daily

day         rx      |     tx      |  total
------------------------+-------------+----------------------------------------
26.01.     42.19 MB  |   10.35 MB  |   52.53 MB   %%%%%%%%%%%%%%%%%%%%:::::
------------------------+-------------+----------------------------------------
estimated       92 MB  |      22 MB  |     114 MB

As said previously, I’m going to post my bandwidth usage daily, either here, or on my Posterous for the next month. I don’t really have a goal here, just want to be able to trim my usage to hopefully stave off some of my internet “dependency” issues..

Stay Tuned!

Filed under  //  bandwidth   life   linux   posterous   self improvement   vnstat  
Jan 25 / 7:37pm

Tracking personal bandwidth usage.

I’ve been on a major self improvement kick lately. I’ve kicked several crazy habits including, but not limited to:

  • Smoking
  • Biting my nails
  • Soda
  • Sugar (practicing moderation)

Next on my self improvement quest, I decided to start monitoring bandwidth usage and tracking it on my blog so I(and you!) can follow how much I’m using, and try to trim it down to a reasonable level. I’m not going to play around, I am seriously addicted to the internet. It is one of my oldest, hardest to moderate addictions EVER. I figured if I kept track of how much I actually use on a daily basis that it would help me moderate myself.

So, this morning I downloaded and installed vnstat and initialized the database for my single interface like so:

sudo vnstat -u -i eth0

Where eth0 is the interface all my network traffic routes through. To track multiple interfaces, run the above command again, swapping out eth0 for the other interface.

Next I fired up the following cron:

*/5 * * * * if [ -x /usr/bin/vnstat ] && [ `ls /var/lib/vnstat/ | wc -l` -ge 1 ]; then /usr/bin/vnstat -u; fi

It samples usage on any interface you specify every 5 minutes and creates awesome statistics from it. So, whenever I have a quick break between tasks, I run vnstat and get a glimpse at my usage.

Now, this is the part that scared me a bit.. I never really thought about how much I use. I fired all of this up at ~9:00AM, the snapshot below was taken at 10:45AM.

bsmith@bsmith-desktop [10:47:06 (0.17)] ~ 
-> vnstat
Database updated: Tue Jan 26 10:45:01 2010

    eth0

       received:      40.68 MB (81.6%)
    transmitted:       9.89 MB (18.4%)
          total:      50.57 MB

                    rx     |     tx     |  total
    -----------------------+------------+-----------
        today     40.68 MB |    9.89 MB |   50.57 MB
    -----------------------+------------+-----------
    estimated        89 MB |      20 MB |     109 MB

I, um, yeah I use the internet, a lot..

There are lots of other fun things you can do with vnstat, but I’ll mainly just look at incremental snapshots, and the money shot: daily usage.

Daily output looks like this:

bsmith@bsmith-desktop [10:47:41 (0.09)] ~ 
-> vnstat -d

eth0  /  daily

day         rx      |     tx      |  total
------------------------+-------------+----------------------------------------
26.01.     42.19 MB  |   10.35 MB  |   52.53 MB   %%%%%%%%%%%%%%%%%%%%:::::
------------------------+-------------+----------------------------------------
estimated       92 MB  |      22 MB  |     114 MB

As said previously, I’m going to post my bandwidth usage daily, either here, or on my Posterous for the next month. I don’t really have a goal here, just want to be able to trim my usage to hopefully stave off some of my internet “dependency” issues..

Stay Tuned!

Filed under  //  bandwidth   life   linux   posterous   self improvement   vnstat  
Dec 18 / 2:14am

It's a yolk!

Enjoy…

That's one large....leg

Filed under  //  life   new baby   ultrasound  
Oct 2 / 10:09pm

It's official, I now have a better half!

It happened, it’s done. I’m a married man and I couldn’t be more excited about it.

At first I was a bit freaked out, I don’t really know why, but it faded quickly as I watched her walk down the isle. I’ll be damned if she isn’t the most gorgeous bride ever. I don’t think there is a man on the planet that would disagree. When she got to me I started shaking. I wasn’t scared, I think I was just blown away that I was about to marry the woman that quite possibly saved my life. Short, sweet, vows were exchanged(I didn’t studder!), we had our kiss (PG-13) and it was done.

The reception was just perfect. Dinner was great, drinks we’re plentiful, everyone was happy and seemed to be having a great time. As far as I know everyone got home safely and responsibly.

Cut to now, things do feel different, but better. More relaxed, less stressed, less worried. I thought I was in love before, but now it’s confirmed. I’ve never been so happy.

So, onto a sappy personal note..

I’m not to proud to admit that I have many weaknesses and faults. I am very grateful that my wonderful wife is there to pick up the slack and remind me to work on fixing them. I’m confident that we can get through anything supporting each other, forgiving each other and loving each other. Together we will grow with our family, always thinking of them and putting them first.

I’m excited, refreshed and wanted to share it with the world. Thanks for reading!

P.S. Today is our one week anniversary :)

Filed under  //  home   life   married  
Oct 22 / 1:28am

Just another manic Monday..

I woke up late, again, checked my son for a rash, poured a cup of coffee and drank a bottle of water. After my relaxation time was over I went to cleaning myself up for work. By this time I realized it was 7:45 and now I was _really_ going to be late. Why was I so late this morning? Because the Indians lost. What does that have anything to do with it? Well...I tried to forget the loss by consuming over the recommended dosage of liquor and beer(in that order) :/

Fast forward and I'm walking into the office. Open my email, seemingly thousands of errors over the weekend. Fixed some filesystems on a few servers, cut the verbosity of some logging down a notch, and discover that it wasn't a DNS problem after all, infact $user had a host file entry.
This was all before 9.

Moving right along, look for this photo at cleveland.com this coming Friday!
From the right: Me, Bob(hiding), Craig, Cory, Mike, Kathy, Martin.

And one last note.. Keep an eye out for adsense ads in the "leftovers" section of my side menu.. I think it might help drive some traffic and make a buck.

Filed under  //  beer   life   site   work  
Sep 14 / 1:40am

Three shots later...

Annnd we have a grump:
Poor Baby
At least we may finally find out what's wrong with him.

Filed under  //  home   kids   life  
Sep 11 / 3:51am

So, at some point, I lost track..

Stepped off the beaten path, veered too far off the shoulder...SOMETHING. Got an announcement today that one of my coworkers wife just had their baby(BTW, Contrats Mike and wife!). Usually this kind of announcement is followed up by me with "Aww, how cute.. Good luck sleeping! I don't envy you!".

Today was different. Today I looked at the picture of the baby, and thought "Man, I'm jealous.". That's an interesting reaction for me, because it made me remember a time when babies and family and all that were exactly what I wanted. I've not felt that for a loooong time. It was nice.. It really makes me feel like I lost track.

Moving on past the sappy stuff; I've found something fun to play with lately. It's called "Let's see how many scripts I would usually write in Perl that I can write in Python instead.". I'm up to four now, and I'm massively impressed with what I've been exposed to. I'm going to give a simple "For instance".

The other day at the office I was tasked with creating a crapload of Redirect rules for Apache. All similar format/results, but different enough that one common RegExp with RedirectMatch wouldn't have done the trick. The list of the source and destination paths were sent to me in an excel file, which I then converted to csv. Rather than copy and paste 50+ of these into the Apache conf and hand tailoring them, I decided to write a script to parse it and spit out the rules I needed.

In python, it was as simple as using an example from here: http://docs.python.org/lib/csv-examples.html

To my knowledge Perl doesn't have any CSV parsing modules in the code distribution, which means CPAN fun will ensue. To get the mega list of installed Perl modules on my host, I have to write a Perl script (no root access).

Here's the script:

#!/usr/bin/perl
use ExtUtils::Installed;
print "$_
" for ExtUtils::Installed->new()->modules;

Run that and grep the output for anything csv.

# ./list_mods.pl | grep -i csv
#

Yup, I was right.. At least as of 5.8.6 (slightly old dist) there's no CSV module installed. So now, let's install one (of the 232 results I got back in a quick search):

# perl -MCPAN -e 'install Text::CSV'

I still have to write the code! I've wasted 10 minutes! Ironically enough, 10 minutes is what it took me to modify a common example of CSV parsing in python and to top it off, the python code is easier on the eyes.

I still LOVE my Perl, and if I'm ever in a pinch and really _need_ to have a script done, like now, I'll probably run to it, or the shell first.

Filed under  //  geek   life   perl   python