First Tattoo – Gallifreyan Circles

Hipster Doctor Who

Hipster 11 thinks your Asian tattoo is totally mainstream, man.

Obviously I’m a huge Doctor Who fanatic, and for my first tattoo I managed to incorporate an awesomely detailed, appropriately subtle, and personally meaningful design into one fantastically inked Tattoo.  Major thanks to Andrew at Golden Eagle Tattoo in Santa Barbara, CA for the belief and follow-through on a design others would have refused to do and Stickerish on Etsyfor providing the fantastic stencil – couldn’t have done it without them!

My respective Reddit and Tumblr posts have been the single most successful experiments in Social Media I’ve ever had, truly a surreal experience to be “internet famous.”

Gallery below:

Snippets from today’s coding (Using SED to Parse Alfred input)

RegEx made to look like FedExMore snippets from my adventures with @AlfredApp and AppleScript.  For this one, I needed to fulfill a couple of requirements, similar in nature to my previous e-mail code:

  1. Most importantly I needed to figure out a way to utilize a single string entry into Alfred that could be interpreted with multiple variables.  Example:  Triggering alfred and typing trigger Severity-Subject-Context producing three distinct variables within an AppleScript:
  1. Severity
  2. Subject
  3. Context
  • I had to use AppleScript because passing the arguments was dependent upon the AppleScript library references, so just popping a shell script wasn’t fully the answer
  • Finally, I needed to grab those values and then create three different e-mails directed to three different parties with (you should probably see where I’m going with this) three different contexts (this was the easiest part).
  • The hardest part about all of this is dealing with Alfred’s input scheme.  As far as I can tell (and even using @preppeller’s own Tumblr) it seems that there’s no easy way to differentiate a single Alfred string to multiple variables.  In that Tumblr piece, Preppeller shows off the following code snippet:

    on alfred_script(q)
      tell application "Things"
        parse quicksilver input q
      end tell
    end alfred_script

    This would be great if it weren’t for the fact that instead of Alfred handling the variables of the input, he’s turning to @CulturedCode’s Things App and its ability to parse out syntax provided.  In my situation unfortunately, @SparrowApp doesn’t have that ability and it’s what I needed (I blame neither party!).  Another good example actually got to me from the team itself while writing this blog, take a look for how he handled it using a shell script.

    So putting around, I decided I was going to use AppleScripts “do shell script” to parse out the line using sed and a relatively complex regex.  I’m sure I could do this much, much better some other way, but this is how I did it!  I figured that since it took me a bit of time, I could help others by providing my tools.  I’m not going to link anything for a bit, but please see links at the bottom of the post for some of the tools and resources I tapped into.  More after the break. Continue reading

    Bit.ly Alfred Shortlinks

    Post #2 in regards to @AlfredApp and it’s quick because I didn’t write it, I just fixed it.  I use Bit.ly links for a lot of things and there was one that I found through Google-Fu but when I tried it, it didn’t work.  You can find his work by clicking here:  kopischke.  This was a long time ago so I was just starting to learn about a lot of the things I’m STILL just starting to learn about, but at a much better rate than before.

    Either way, tinkering and tooling got it back (seriously, just a URL change?  I remember this taking wayyyyy longer)  Code below and extension below or just follow the fork on his GitHub.  You’ll need to get your API key from the bit.ly guys but that should be about it.  Questions?  Throw’em in the comments:

    # modified API url to align with changes to bit.ly requirements - @claylevering
    # find the .alfredextension here: http://cl.ly/EEUK
    
    declare -r API='https://api-ssl.bitly.com/v3/shorten'
    declare -r LOGIN='yourlogin'
    declare -r API_KEY='yourapi'
    
    	# add http scheme to URL if none is provided
    	longURL=$(printf "{query}" | sed -E -e 's|^.|http://&|' -e 's|^http://([a-zA-Z\-\.\+]+://)|\1|')
    
    	# shorten URL
    	shortURL=$(curl -sf -d "login=$LOGIN&apiKey=$API_KEY" --data-urlencode "longURL=$longURL" -d "format=txt" $API)
    
    	declare -i curlExit=$?
    	if [ -n "$shortURL" ]; then
    		printf $shortURL | pbcopy
    		echo "Bit.ly Generated!"
    		echo $shortURL
    		exit 0
    	elif [ $curlExit -eq 22 ]; then
    		errMsg="URL '$shortURL' could not be shortened because of a bit.ly server error. Your URL, login or API key may be invalid, or bit.ly may be experiencing technical difficulties."
    	else
    		errMsg="URL '$longURL' could not be shortened because of a technical error. The 'curl' command returned with exit code $curlExit. Check the man page for curl for details."
    	fi # [ -n "$shortURL" ]

    And the extension is here: Bit.ly Shortlink.alfredextension

    Canned Sparrow e-mails with Alfred

    The Alfred Butler's Hat

    AlfredApp.com

    This is my first post, and I warn you all by mentioning I’m a novice scripter.  My knowledge comes primarily through mass googling as I have no resources locally that have the time, patience, or even knowledge to help me on my own.  So here goes:

    With Alfred 1.1 we have the ability to throw highlighted text directly to a parameter in Alfred.  So for example, dealing with Social Media and Customer Support I wanted a tool i could use from my computer without having to open anything where I could grab some text, toss to Alfred and have it generate an e-mail with that text and send it out to my ticket processing CRM.  This lets me focus on the content and later I can go back in and re-tag and edit the tickets I’ve created (and the metrics that now work!).  So I wanted two things:

    1. The ability to create a “Blank” version of my canned message that allowed me to add some notes if I wanted to but that created the ticket e-mail as normal
    2. The ability to create a “Filled” version of my canned message including the highlighted text I had so I can get back to where I saw the important item – most of the time, this ends up being a URL to a tweet or something.

    I created the following AppleScript Extension.  At first, I had a bit of problems getting the parameter checked out, but with the help of @AlfredApp and @BinaryGhost, we managed to figure it out:

    on alfred_script(q)
    	set q to q as text
    	if (q is equal to "") then
    		log "no parameter"
    		set alfredInput to "Other"
    		set q to "Other"
    	else
    		log q
    		set alfredInput to q
    	end if
    
    	using terms from application "Sparrow"
    		tell application "Sparrow"
    			activate
    			set theMessage to make new outgoing message with properties {subject:"CANNED EMAIL SUBJECT - PARAMETER:  " & alfredInput, content:"All
    
    This is a canned e-mail being generated by Alfred using an AppleScript Extension.  If it contains a parameter, it will be listed below and in the subject.
    
    PARAMETER:  " & alfredInput & "
    Details (optional):  ", message signature:"YOUR SIGNATURE"}
    			tell theMessage
    				make new to recipient at end of to recipients with properties {name:"RECIPIENT NAME", address:"RECIPIENT@EMAIL.ADDRESS"}
    				compose
    			end tell
    		end tell
    	end using terms from
    end alfred_script

    As you can see in this code the variable “alfredInput” is what will be replaced by the parameter provided and if it is not given, it will default to the text, “Other”.  There are a couple of nice features you can toggle in and out of this – the way I’ve written it the cursor will “end” following “Details:  ” allowing you to trigger the extension and then begin immediately adding details to whatever it is you’ve started.

    Alternatively, you can replace “compose” with “sendmessage” for a truly canned message that will send automatically.

    Feel free to grab the extension here: Canned Sparrow E-Mail.alfredextension

    A résumé of sorts

    Hello all!

    I figured I would get this started by posting a résumé of sorts.  My name is (obviously) Clay Levering and I am here as both a tech enthusiast and what I imagine as some type of “ultimate geek.”  But sometimes it takes a lot to really understand what that means about people – I mean everyone has that one person they know that does tech stuff – but I’m the person THOSE people come ask questions:  Seriously.  So this is my résumé so to speak. You can do with it what you’d like, but all you really need to know is that I’m going to be able to answer your question, just as simple as that.

    Continue reading