Archive

Posts Tagged ‘random’

If Ping, Then Bling

June 19th, 2011 No comments

There’s something soothing about a visual heartbeat.

So I was chilling at the Starbucks near me this morning. In fact, I still am right now. It’s pretty sweet that they offer free wifi, but it tends to be laggy and unreliable due to having gobs of leeches like me suckiing it up. I’m often in the middle of waiting for a web page to reload or an ssh session to do something, and I wonder to myself “frick, am I even still connected?”. So I wrote a little script to help keep me from having to think much (my favorite kind of scripts).

I basically wanted a script that would make something blink on my laptop for a moment on each successful return of an ICMP echo request (ping). Sort of a visual heartbeat. While ping is a terrible measure of whether your layer 3 path will support TCP, without a layer 3 path you will get no ping. So it’s good enough. I decided to use the “standby” light, since it wouldn’t be doing a whole lot while the laptop was actually running. Capslock, numlock, etc. It can be any light as long as it typically holds one state or the other. I’m posting a version of the script here that’s much simpler and uses the ThinkPad’s “ThinkLight” as the bling source. I think it’s easier to take away from this script exactly what’s going on and how to modify it to your liking.

I’m actually fairly happy to have been annoyed just enough by the connection at Starbucks to get motivated to write this. As a network engineer I’m constantly on the road trying to connect to this or that, or what I’m doing depends on constant connectivity to thus or thus. Not having to check a bunch of terminal windows for heartbeats will be great.

#!/bin/bash
# pingbling.sh - If ping, then bling.

# Typically you've got to be root to mess with changing sysfs/proc values
if [ "$(id -u)" != "0" ]; then
   echo "This script must be run as root"
   exit 1
fi

# Script spits out tons of crap if there are no args.  saving sanity.
if [ -z $1 ] ; then
  echo "Please supply an IP address or hostname to ping"
  exit 1
fi

while true ;
do
  # we're already seeing the bling from the ping, we don't need stdout too.
  # dialing in a longish return time since this is a "are we still connected" test
  # and not a "how fast is my connection" test.
  ping -c1 -W3 $1 > /dev/null
  if [ $? -eq 0 ] ; then
    state_before=$(head -1 /proc/acpi/ibm/light | awk '{ print $2 }')
    echo "on" > /proc/acpi/ibm/light
    sleep 0.2
    echo "off" > /proc/acpi/ibm/light
    echo $state_before > /proc/acpi/ibm/light
    sleep 0.8
  fi
done

exit 0
Categories: Uncategorized Tags: , , ,

Getting men to help

August 12th, 2010 No comments

Last night I had to go to the store to get rum. The rum was gone. I posted about it on facebook. It was a problem. I announced my intention to my loving fiancee, who promptly asked me “honey, could you get me tampons?” in the most adorable “I know you won’t want to do this, but I know you will if I’m cute enough about it” face. It’s cool. I’m a man, I’m secure in my manliness. She starts to describe what it is she needs me to get. I tell her to just get me the box. She brings out the box and continues her description. I just rip off the top and put it in my pocket. She seemed surprised at my concise resourcefulness. These matters are not to be trifled with.

Ladies, ladies, ladies… If you translate things like this into a framework men can understand, and make a joke out of it, we’ll be much more likely to help out. For this case, think of an ordered system men are familiar with, and get as close to that system as you can. Below is a table of simple translations for you, and a few sound clips. Sounding right is important, you want to lock in as many senses as possible.

The tampon chart, for men:

What you need: In man-speak: Pronounce as:
Light absorbency FIRST BLOOD! click here
Regular absorbency DOMINATING! click here
Super absorbency RAMPAGE! click here
Super Plus absorbency GODLIKE! click here
Ultra absorbency UNSTOPPABLE! click here

Try it out. Teach your man the scale and next time you’re running low, tell your man you need box of RAMPAGE! or two. Just make sure he doesn’t end up flagging a customer service monkey. That could get awkward.

A Challenger Appears: Creepy Segway Guy

June 25th, 2010 4 comments

So there’s this guy at our place with a Segway. You know, the dorky pogo stick with wheels that middle age yuppies and mall cops think are really cool. Well, this guy thinks it’s real cool. And he’s fucking creepy about it. I first heard about CSG one saturday morning when Emily came into the apartment after doing something or other downstairs. She said “did you know there was a guy with a Segway that lives here?” to which I of course said no. I mean, who really owns those things in real life? Turns out, that guy does.

Not only did she run into this random dude with a Segway, he was in the elevator. Standing in the back corner of the elevator car. On his Segway. Staring at the doorway when it opened. I’ve never run into him in that capacity, but I have seen him come out the back door of our apartment tower to take the trash out to the dumpster, buzzing along on his merry way. This struck me as odd since it isn’t exactly a long haul to the dumpster. I used my trusty jet pack to get a good view to illustrate:

(clicky for larger image)

I mean, a minute or so out in the harsh wide open. Maybe he’s a vampire, and he’s afraid he’ll either burn up if he’s outside for too long… or blind some people with his sparkly skin (depending on your flavor of vampire). The really creepy part is that he was just throwing away small bags, and we have trash chutes on each floor that they could have easily fit in. Maybe he didn’t want the facilities guy going through his trash in the morning? Sounding more and more like this guy is ditching body parts.

Today it got even more weird… I saw this random creepy white van when I was driving into the parking lot. It’s never been here before. It looked like someone was moving or something, because the back was open and there was what I thought was a dolly on the back. Nope, it was a Segway. Just like the trash incidents, it’s only a couple dozen paces from the door. And although he’s not exactly in underwear model shape, he’s not so massive and slovenly that he needs a machine to get around. So there CSG was, washing down the outside of his totally not sketchy windowless white van. Cleaning blood, no doubt. Dismembering bodies is messy business.

Although I risked life and limb to get this next picture, I figured the internet deserved more than one lousy shot. So stealthy as I could I got another. It’s not immediately obvious from the thumbnail, but he is no in fact riding the Segway naked. Although I’m guessing that’s in the near future. He’s just wearing skin colored clothes. I guess it could be clothes made of skin, I was kind of far away…

A little early…

February 11th, 2010 1 comment

…But happy early V-Day from the random awesomeness that is the internet. I don’t usually make “hey check out this pic” posts, but this one is kind of a gem. And it’s almost seasonal.


Originally published at The IggBlog. You can comment here or there.