Basic Math

Written by Mitch in Misc on Wed 24 June 2015. Tags: python, basic math,

Python Basic Math

I had been interviewing lately... (its more official now which is why I'm writting about it) I did a bunch of interviews, some wanting to test my python prowess, and well they stumped me. On basic math with python... yeah I was extremely frustred by the experince as I've been doing python for years... never had many on the spot, do some basic math now kind of moments. None the less, it irritated me. So, I went home and revisited the question. Not 5 minutes later I had the answer, but it bugged me the whole drive home. Which is something I do alot, something bugs me reguardless of how small and meaningless (like needing to do basic math in python), I'm posting here for posterity. Question is not word for word what I got, because I didn't copy it, but heres the basics of it:

Write a script that will check numbers 1 through 100, to see if they are divisible by 4, if they are print "word". If they are divisible by 6, print "anotherword", if they are divisible by both, print "both". Otherwise print the number.

for x in range(1,101):
    is4 = False
    is6 = False
    if float(x/4.0).is_integer():
        print str(x) + "/4 = " + str(float(x/4.0))
        is4 = True
    if float(x/6.0).is_integer():
        print str(x) + "/6 = " + str(float(x/6.0))
        is6 = True
    if is6 is True and is4 is True:
        print str ...

Continue reading »


Watching Smokeping

Written by Mitch in Monitoring on Sat 02 May 2015. Tags: monitoring, smokeping,

I switched over a really crappy DSL connection from CenturyLink yesterday, to an even worse company but with better bandwidth(The trade-offs I'm forced to make). As a matter of curiosity and all around just being a geek. I run smokeping on my connection so I can watch the historical timeline and potentially have proof/evidence of a crappy connection if I need it. Assuming of coarse, I could ever get someone at tech support that would be able to understand the graph... anyway. Below is a quick recap of the decrease in latency of my internet connection from the switch over. It also shows what streaming Netflix does to the connection on the DSL before... and the minor difference it makes after the change over(Kids have been streaming something all morning). Anyway, I thought it was interesting, and would post for historical purposes.

Before, After Switch to Cable

Continue reading »