Barry Morrison aka @esacteksab | basketcase

19Jan/120

A little bash: for-loops, arrays

I wrote this...the baby geek in me is proud.  I know simple for you l33t hackers, but I am not.

#!/bin/bash

PROD=( PROD1 PROD2 PROD3 PROD4  )
STAG=( STAGING1 STAGING2 STAGING3 STAGING4 )

## DATES
fedate=`date +%m%d%Y`
fsdate=`date +%m%d%Y --date="1 week ago"`
enddate=`date +%m/%d/%Y`
startdate=`date +%m/%d/%y --date="1 week ago"`

## RESPONSE

for i in "${PROD[@]} ${STAG[@]}"
do

    curl "http://server.domain.com/lib/page1.php?startdate=$startdate&enddate=$enddate&dataclass=SPEED&environment=$i" -o $i-response-$fsdate-$fedate.png

done

for i in "${PROD[@]}"
do
	curl "http://server.domain.com/lib/page2.php?startdate=$startdate&enddate=$enddate&dataclass=REQUESTS&environment=$i" -o $i-requests-$fsdate-$fedate.png

done

for i in "${STAG[@]}"
do
	curl curl "http://server.domain.com/lib/page3.php?startdate=$startdate&enddate=$enddate&dataclass=REQUESTS&environment=$i" -o $i-requests-$fsdate-$fedate.png

done
Did you like this? Share it:
18Jan/120

Configuring R1Soft Backups on Ubuntu after kernel upgrade

This is purely for my own sanity/sake of remembering.

$ apt-get install linux-headers-`uname -r`

then

$ r1soft-cki
Did you like this? Share it:
Filed under: Linux, Technology No Comments
25Dec/110

Pictures of my HTPC

https://plus.google.com/u/0/117262625466337208048/posts/Bg8JMApzF5Z

Did you like this? Share it:
Tagged as: , No Comments
22Dec/110

2011 In Review

2011 was an interesting year to say the least.  Not to say prior years were any less interesting, this one seemed to hold a lot of changes, some more significant than others. The biggest change for me in 2011 quite possibly was me leaving my job at The University of The Pacific after more than 4 years.  I learned a long time ago, that life is too short to be unhappy, and even though change may be inevitable, it rarely happens when we need it to, and in those circumstances, it's simply best to MAKE change happen. I struggled with leaving for personal and professional reasons.  I was VERY good at my job, more time there would only allow me to hone the skills I possessed and gain more skills.  Professionally, it made A LOT of sense for me to stay, and was the primary motivation for me to stay.  I had also created MANY friendships and business relationships with individuals because of my job.  MANY I hope to maintain even after my departure.  Personally, it would have been the death of me (quite literally!).  The amount of anger and stressed bottled up, day-in and day-out was most certainly not healthy.

It was scary to think about leaving, it was scary to interview again (after more than 4 years) and it was scary to say good bye and take a risk with a new company (especially with how secure my job was -- in this economy).  But it's also exciting.  Looking for a job shows you the possibilities, getting to interview puts you in the hot seat, and even though I suck at interviews, it was fun! I essentially interviewed for 4 companies.  The first a game company, they were looking for a jr. Linux admin, I was looking to jump ship from Windows to Linux.  The phone screen went well, but it wasn't meant to be as HR didn't move fast enough, and no official position existed, so as much as I loved what that job could/would have been, it simply not meant to be.  The second potential job was for another university.  This would have very much been a lateral move for me.  Though I worked for central-IT for The University of the Pacific, this role was for a department, that part wasn't something I was looking forward to, but their environment was new and well built, with great hardware, small team, latest and greatest.  I could have been very happy there.  It was  a combination of reasons why I didn't choose to go there, but whoever does get the position, I'm certain will love it, as I know I could have been happy there.  The third company was a financial broker in San Francisco's financial district.  VERY COOL!  I always thought it'd be neat to work "in the city".  The commute was VERY easy (quick 45-minute train ride and 5 minute walk).  It was 100% Windows-based environment, I could have walked in and been right at home.  It was more app-level support and less infrastructure, not that that's a bad thing.  It was purely a gut feeling not accepting that position, though the salary was enticing to say the least! The fourth company was for a technology company in the Silicon Valley.  Luckily I had an "in".  Interview was by no stretch of the imagination easy, but those that interviewed me, I knew I wanted to work for/with, as the opportunity to learn would be endless.  The hiring recruiter and my "to-be boss" said something to the effect of  "we don't care who you are, what you look like, what you wear, we have people from all walks of life, we simply want the best person for the job."  I felt at home, before I even had an offer.  And boy did I have to wait for an offer!!!  TOO stressful!!!

None the less, they did make an offer...I obviously accepted.  I've been there almost two months now and couldn't be happier.  AMAZING!  You might be asking "where is this fantastic place?!"  I'm not telling.  It's simply easier this way.  Trust me. So you might be asking "What are you doing?!"  My official title is Linux Systems Engineer.  I manage hundreds of Linux servers around the world.  Well I don't personally, me and a team of 10 others do.  So yeah.  The bad (cause life ain't all rainbows and unicorns), I don't touch storage, I don't touch virtualization.  I simply touch servers! It's also unlikely I will get to see/touch new technology.

I went through another car/truck.  The Corvette was a love/hate, replaced with a 2007 Trailblazer 3SS.  No matter what anyone tells you, mileage sucks!  13MPG on a good day, 10MPG on average, 8MPG on a bad day!  The TBSS went away as I got tired of high gas prices, premium gas and shitty mileage.  It seems I go through these periods of my life where I simplify.  This was certainly one of those years.  I've ended up in a 2012 Chevrolet Cruze Eco.  I know! VERY drastic change from a C5 Z06 or a TBSS.  Trust me! I KNOW!  It's a nice car for what it is, anyone who needs a nice commuter, or a first car for a teenager, I'd recommend it.  I did get mine with a manual transmission (as I missed it from the Corvette).  Driving in the city is NOT as bad as I thought it would be, no regrets there.  It is unlike any other manual I've ever driven.  STILL getting used to it, even after a few months.

Personally, I wish I could say 2011 was as good for me as it was good for me professionally, but I continued to struggle with the loss of someone I cared about more than I cared about anyone else.  No, she didn't die, though sometimes I think it'd be easier if she had, as I believe death is a part of life and easier to get over.  Her being a part of my circle of friends (or what was my circle of friends -- nother reason I moved, I didn't want the reminders in my life) made it more difficult.  It taught me a lot about myself, good, bad, or otherwise.  I wish this feeling upon no one (well maybe just one person).  Through all of it, it taught me who my real friends were, and for that I am thankful.  I ended 2010 haven gotten a dog (Louie).  He's come a long way since I got him, still a ways to go, and he'll never be "normal" simply because of the life he had before I got him.  It's been a love/hate and regularly a struggle between the two of us (with me not always winning), but he's been good for me, and I wouldn't/couldn't let him go...so he's here (for now).

I put on all the weight I lost (and then some) in 2008/2009.  This has obviously not been good.  I really hope 2012 leaves behind the things it needs to and brings the things it needs to so I can get back where I was and move forward.  If for no other reason than to be healthier.  I should probably also start cooking again.  For a number of reasons: 1) it's obviously healthier 2) it's INSANELY cheaper (when done right)!

I want to be healthier and happier in 2012.  I've been given an amazing opportunity financially and I don't want to waste it...so I want to be smarter with my money.  I may not have many friends left, but the ones that I do, I want to appreciate them more, joke less (to ensure I keep them) and maybe make new friends.  I also haven't been back to CO since my grandma passed away.  I need to go home.  But I'd also like my family to come out here and see the life I have here.  It's a simple life, but it is my life and I like it. I'd also love to get knee deep in a project (whatever that may be).  I want to get more in-depth with Python.  Maybe jump back into xHTML/CSS/JS as I miss that.  But whatever I do, I need to be focused and see it through to the end.

2011 was most certainly NOT the worst year of my life.  I guess this would be the upswing (at least I hope it's the upswing!).

Did you like this? Share it:
Filed under: Life No Comments
15Oct/110

[Brain Dump] Arduino + Python & Serial

I've started playing with Arduino, I've always been fascinated with it.  AND having been slowly teaching myself Python, why not try and make the two talk to each other?  Tonight (10/15/11) I found success!  Now, it's nothing spectacular.  A simple LED on my breadboard, two Python scripts (one passes '0', the other passes '1'), based on the value sent via serial, an LED will light.  None the less, these links below proved VERY valuable.  LOTS to learn, but well on my way!

http://www.arduino.cc/playground/Interfacing/Python
http://www.akeric.com/blog/?p=1015
http://www.akeric.com/blog/?p=1140
http://www.tigoe.net/pcomp/code/communication/interpreting-serial-data-bytes
http://www.arduino.cc/en/Reference/ASCIIchart
http://www.asciitable.com/
http://principialabs.com/arduino-python-4-axis-servo-control/

Did you like this? Share it:
15Oct/112

New HTML5-boilerplate Stylus CSS

A previous (older) version exists here. Like the previous version All comments were left in the style sheet.  All credits go to the original authors.  All I did was convert to Stylus since that is what I'm using with Express.  I HAVE NOT tested this.  I simply converted it and stuffed the comments back inline.

/*
* HTML5 ✰ Boilerplate
*
* What follows is the result of much research on cross-browser styling.
* Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
* Kroc Camen, and the H5BP dev community and team.
*
* Detailed information about this CSS: h5bp.com/css
*
* ==|== normalize ==========================================================
*/
/* ============================================================================
HTML5 display definitions
========================================================================== */

article, aside, details, figcaption, figure, footer, header, hgroup, nav, section
 display: block

audio, canvas, video
 display: inline-block
 *display: inline
 *zoom: 1

audio:not([controls])
 display: none

[hidden]
 display: none

/* =============================================================================
 Base
========================================================================== */

/*
 * 1. Correct text resizing oddly in IE6/7 when body font-size is set using em units
 * 2. Force vertical scrollbar in non-IE
 * 3. Prevent iOS text size adjust on device orientation change, without disabling user zoom: h5bp.com/g
 */

html
 font-size: 100%
 overflow-y: scroll
 -webkit-text-size-adjust: 100%
 -ms-text-size-adjust: 100%

body
 margin: 0
 font-size: 13px
 line-height: 1.231

body, button, input, select, textarea
 font-family: sans-serif
 color: #222

/*
 * Remove text-shadow in selection highlight: h5bp.com/i
 * These selection declarations have to be separate
 * Also: hot pink! (or customize the background color to match your design)
 */

::-moz-selection
 background: #fe57a1
 color: #fff
 text-shadow: none

::selection
 background: #fe57a1
 color: #fff
 text-shadow: none

/* =============================================================================
 Links
 ========================================================================== */

a
 color: #00e

a:visited
 color: #551a8b

a:hover
 color: #06e

a:focus
 outline: thin dotted

/* Improve readability when focused and hovered in all browsers: h5bp.com/h */

a:hover, a:active
 outline: 0

/* =============================================================================
 Typography
 ========================================================================== */

abbr[title]
 border-bottom: 1px dotted

b, strong
 font-weight: bold

blockquote
 margin: 1em 40px

dfn
 font-style: italic

hr
 display: block
 height: 1px
 border: 0
 border-top: 1px solid #ccc
 margin: 1em 0
 padding: 0

ins
 background: #ff9
 color: #000
 text-decoration: none

mark
 background: #ff0
 color: #000
 font-style: italic
 font-weight: bold

/* Redeclare monospace font family: h5bp.com/j */
pre, code, kbd, samp
 font-family: monospace, serif
 _font-family: 'courier new', monospace
 font-size: 1em
/* Improve readability of pre-formatted text in all browsers */
pre
 white-space: pre-wrap
 word-wrap: break-word

q
 quotes: none

q:before, q:after
 content: none

small
 font-size: 85%
/* Position subscript and superscript content without affecting line-height: h5bp.com/k */
sub, sup
 font-size: 75%
 line-height: 0
 position: relative
 vertical-align: baseline

sup
 top: -0.5em

sub
 bottom: -0.25em

/* =============================================================================
 Lists
 ========================================================================== */

ul, ol
 margin: 1em 0
 padding: 0 0 0 40px

dd
 margin: 0 0 0 40px

nav ul, nav ol
 list-style: none
 list-style-image: none
 margin: 0
 padding: 0

/* =============================================================================
108 Embedded content
109 ========================================================================== */

 /*
 * 1. Improve image quality when scaled in IE7: h5bp.com/d
 * 2. Remove the gap between images and borders on image containers: h5bp.com/e
 */

img
 border: 0
 -ms-interpolation-mode: bicubic
 vertical-align: middle

/*
 * Correct overflow not hidden in IE9
*/

svg:not(:root)
 overflow: hidden

/* =============================================================================
 Figures
 ========================================================================== */

figure
 margin: 0

/* =============================================================================
 Forms
 ========================================================================== */

form
 margin: 0

fieldset
 border: 0
 margin: 0
 padding: 0
/* Indicate that 'label' will shift focus to the associated form element */
label
 cursor: pointer

/*
 * 1. Correct color not inheriting in IE6/7/8/9
 * 2. Correct alignment displayed oddly in IE6/7
 */

legend
 border: 0
 *margin-left: -7px
 padding: 0

/*
 * 1. Correct font-size not inheriting in all browsers
 * 2. Remove margins in FF3/4 S5 Chrome
 * 3. Define consistent vertical alignment display in all browsers
 */

button, input, select, textarea
 font-size: 100%
 margin: 0
 vertical-align: baseline
 *vertical-align: middle

/*
 * 1. Define line-height as normal to match FF3/4 (set using !important in the UA stylesheet)
 */

button, input
 line-height: normal

/*
 * 1. Display hand cursor for clickable form elements
 * 2. Allow styling of clickable form elements in iOS
 * 3. Correct inner spacing displayed oddly in IE7 (doesn't effect IE6)
 */

button, input[type="button"], input[type="reset"], input[type="submit"]
 cursor: pointer
 -webkit-appearance: button
 *overflow: visible

/*
 * Consistent box sizing and appearance
 */

input[type="checkbox"], input[type="radio"]
 box-sizing: border-box
 padding: 0

input[type="search"]
 -webkit-appearance: textfield
 -moz-box-sizing: content-box
 -webkit-box-sizing: content-box
 box-sizing: content-box

input[type="search"]::-webkit-search-decoration
 -webkit-appearance: none

/*
 * Remove inner padding and border in FF3/4: h5bp.com/l
 */

button::-moz-focus-inner, input::-moz-focus-inner
 border: 0
 padding: 0

/*
 * 1. Remove default vertical scrollbar in IE6/7/8/9
 * 2. Allow only vertical resizing
 */

textarea
 overflow: auto
 vertical-align: top
 resize: vertical

/* Colors for form validity */
input:valid, textarea:valid

input:invalid, textarea:invalid
 background-color: #f0dddd

/* =============================================================================
 Tables
 ========================================================================== */

table
 border-collapse: collapse
 border-spacing: 0

td
 vertical-align: top

/* ==|== primary styles =====================================================
 Author:
 ========================================================================== */

/* ==|== media queries ======================================================
 PLACEHOLDER Media Queries for Responsive Design.
 These override the primary ('mobile first') styles
 Modify as content requires.
 ========================================================================== */

@media only screen and (min-width: 480px){
 /* Style adjustments for viewports 480px and over go here */
}

 @media only screen and (min-width: 768px){
 /* Style adjustments for viewports 768px and over go here */
}

/* ==|== non-semantic helper classes ========================================
 Please define your styles before this section.
 ========================================================================== */

/* For image replacement */
.ir
 display: block
 border: 0
 text-indent: -999em
 overflow: hidden
 background-color: transparent
 background-repeat: no-repeat
 text-align: left
 direction: ltr

.ir br
 display: none
/* Hide from both screenreaders and browsers: h5bp.com/u */
.hidden
 display: none
 visibility: hidden
/* Hide only visually, but have it available for screenreaders: h5bp.com/v */
.visuallyhidden
 border: 0
 clip: rect(0 0 0 0)
 height: 1px
 margin: -1px
 overflow: hidden
 padding: 0
 position: absolute
 width: 1px

/* Extends the .visuallyhidden class to allow the element to be focusable when navigated to via the keyboard: h5bp.com/p */
.visuallyhidden.focusable:active, .visuallyhidden.focusable:focus
 clip: auto
 height: auto
 margin: 0
 overflow: visible
 position: static
 width: auto

/* Hide visually and from screenreaders, but maintain layout */
.invisible
 visibility: hidden

/* Contain floats: h5bp.com/q */
.clearfix:before, .clearfix:after
 content: ""
 display: table

.clearfix:after
 clear: both

.clearfix
 *zoom: 1

/* ==|== print styles =======================================================
 Print styles.
 Inlined to avoid required HTTP connection: h5bp.com/r
 ========================================================================== */

@media print
 *
 background: transparent
 color: black
 box-shadow: none
 text-shadow: none
 filter: none
 -ms-filter: none

 a, a:visited
 text-decoration: underline

 a[href]:after
 content: " (" attr(href) ")"

 abbr[title]:after
 content: " (" attr(title) ")"

 .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after
 content: ""

 pre, blockquote
 border: 1px solid #999
 page-break-inside: avoid

 thead
 display: table-header-group

 tr, img
 page-break-inside: avoid

 img
 max-width: 100%

 @page
 margin: 0.5cm

 p, h2, h3
 orphans: 3
 widows: 3

 h2, h3
 page-break-after: avoid
Did you like this? Share it:
22Sep/110

[Brain Dump] Graphite/Collectd/Ubuntu

http://collectd.org/

http://graphite.readthedocs.org/en/1.0/index.html

http://collectd.org/wiki/index.php/Plugin:NetApp
http://collectd.org/documentation/manpages/collectd.conf.5.shtml#plugin_netapp

http://collectd.org/wiki/index.php/Plugin:SNMP

http://tompurl.com/2011/08/12/installing-graphite-on-ubuntu-10-4-lts/

https://gist.github.com/982866
https://gist.github.com/862471

http://graphite.wikidot.com/quickstart-guide

https://github.com/joemiller/collectd-graphite

http://agiletesting.blogspot.com/2012/01/graphing-alerting-and-mission-control.html

Did you like this? Share it:
18Sep/110

Vim Essential Plugins from NetTuts+

I stumbled upon this the other night browsing for Python tutorials. Depending on your workflow/title/job description, not all of these could be for you, but I found a few useful that I'm going to try and work into my workflow. Have it it! And Good Luck!

http://net.tutsplus.com/sessions/vim-essential-plugins/

Did you like this? Share it:
Tagged as: No Comments
18Sep/110

Python+HTTPRequests+Reddit

This is a piece of a puzzle if you will. I needed a way to get to Reddit's JSON API with Python. I decided to use HTTPRequests for it's simplicity. Reddit's API told me what I needed to pass. I'll admit here now that my experience in Python/JSON/API/Whatever is VERY weak, I guess I'd like more documentation/examples, etc. etc. but I guess I can't have my cake and eat it too!

As I said this is the first piece of a puzzle. Simply a means to document this now, I'm working on a github repository which right now is purely tests. But if you wanna follow me now, I'm certain I'll get things sorted out, and this code posted up and it'll obviously grow as the project progresses. No I won't tell you what the project is yet. In time, you'll likely figure it out.

 import requests
 import json

 uname = 'UserABC123'
 upasswd = 'Itsasecret!'

 login_url = 'http://www.reddit.com/api/login/+uname'
 self_info_url = 'http://www.reddit.com/api/me.json'

 params = {
     'api_type': 'json',
     'passwd': upasswd,
     'user': uname
 }

 rlogin=requests.post(login_url, params)

Once I'm connected I can call 'rlogin' and it'll return 'modhash' and 'cookie'. With this, I can put the cookie in a "cookie jar" and do what I need to. Which I will post here shortly once I get the code cleaned up.

>>>
>>> rlogin
<Response [200]>
>>> rlogin.content
'{"json": {"errors": [], "data": {"modhash": "ofofofoofofofoffooffofofofofofofofoffofofofof", "cookie": "12345678,2011-09-18T18:33:54,9ofofofofofofofofofoffofofofofofofofoffo"}}}'
Did you like this? Share it:
4Sep/110

[brain dump] Learning Python Resources

I decided to post my collection of links that I've found while starting to learn Python.  They're in no particular order.  I may come back later and add comments/etc. based on my experience, but this is simply a collection of resources I've found while starting to learn Python.

http://code.google.com/edu/languages/google-python-class/index.html

http://i.imgur.com/YQafj.png

http://code.google.com/appengine/docs/python/gettingstarted/

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/

http://diveintopython.org/toc/index.html

http://codingbat.com/

http://www.lightbird.net/py-by-example/

http://rgruet.free.fr/PQR26/PQR2.6.html

http://www.udemy.com/learn-python-the-hard-way/

http://learnpythonthehardway.org/

http://www.swaroopch.com/notes/Python

http://www.pythonchallenge.com/

http://www.youtube.com/user/thenewboston#p/search/0/4Mf0h3HphEA

http://net.tutsplus.com/tutorials/python-tutorials/python-from-scratch-getting-started/

http://docs.python.org/tutorial/

http://python.net/%7Egoodger/projects/pycon/2007/idiomatic/handout.html

http://thinkcode.tv/catalog/programming-python/

http://www.thenewboston.com/?cat=40&pOpen=tutorial

http://www.doughellmann.com/PyMOTW/contents.html

http://www.khanacademy.org/#computer-science

http://www.oreillyschool.com/certificates/python-programming.php

http://www.reddit.com/r/Python/comments/ok0bm/where_is_the_best_place_to_start_learning_python/

If you have a resource that you've found valuable, I'd love to hear about it.  Post up in the comments!

Did you like this? Share it: