Previous month:
December 2012
Next month:
February 2013

Keyboard Maestro: Look up a shorter synonym on Thsrs

My friend Bill told me about the nifty site Ironic Sans, and from there I discovered this post about the short-synonym service called Thsrs. As a word-guy, this really tickles me. So I quickly whipped up a Keyboard Maestro macro to make look-ups easier. The macro is illustrated below or you can downloaded at this gist.

Yes, there's probably some nifty Javascript bookmarklet way of doing this. But my hammer is Keyboard Maestro and I want to be able to use Thsrs from any app, so this suits me better. (Not that I wouldn't like a JS solution, too.)

Screenshot 1 17 13 3 22 PM


Keyboard Maestro: Make Link with Title from Clipboard

This Keyboard Maestro macro is a key part of my blogging workflow. It retrieves the title of a webpage, massages the title to correct capitalization, then puts the title and URL in a fully-formatted href.

For example, let's say you want to link to the webpage "Is your documentation meant to be read?" at http://www.g2meyer.com/usablehelp/singles/709.html. Simply copy the URL to the clipboard, then invoke the macro (I use the Keyboard Maestro menu bar item for this.)

Now switch to the document where you want to use the link and paste the clipboard. The results will look like this:


< href="http://www.g2meyer.com/usablehelp/singles/709.html">Usable Help - Is Your Documentaton Meant to Be Read?< /a>

Notice that the title of the webpage has been changed to Title Case. Keyboard Maestro handily has built in support for John Gruber's fancy-schmancy scheme for doing this quite intelligently.

The macro is fairly straightforward. The meat of it uses Keyboard Maestro's variable support and a Python script to fetch the HTML source from the site and pull out the < title > tag. It does this in a very old-school fashion because I didn't want to require the use of any modules that aren't part of a standard Python installation.

GetTitle 6

The collapsed "Execute Shell Script" step contains the Python script, which you can download from gist.

If this macro tickles your fancy, check out Nothing Up My Sleeve: Keyboard Maestro: Wrap URL.

Update: Keyboard Maestro v6.0 makes this a lot easier.


Arduino Esplora as a thermostat

I have long been tempted to dive into the world of Arduino, but I'm a software guy who knows nothing about electronics, so the thought of breadboarding and assembling circuits was too high of a barrier for me. Looks like someone who knows better realized this as the new Arduino Esplora includes a good number of fun sensors built-in. This is the perfect sandbox for someone like me, so I eagerly visited my local Radio Shack to buy one. (As a side note, I haven't been in a Radio Shack for years, and I was shocked to see how much of the floor space is dedicated to selling cell phones and cell phone accessories. Yeesh.) My very first Arudino Esplora script (aka "sketch") is nothing fancy, but it's useful. Press the down button on the joypad and the Esplora blinks the current room temperature. Additionally, the LED brightness is determined by reading the current ambient light level in the room Whee! Note that because the Esplora is USB-powered, you can use an iPhone (or iPod, etc) power supply to run it. I've put the source below, but visit the gist version for the latest as I won't be updating this post with any revisions.
#include <Esplora.h>
//Press the Down button on joypad to display current temperature
//The red LED blinks the tens value, the blue blinks the ones value. Green indicates end.
//example: red red red blue blue green is 32 degrees (F)
//the light sensor is used to dim the LEDs in a brightly lit room

//copyleft Jan 01 13 www.gordonmeyer.com

// delay used to blink lights
int flashdelay = 250;


void setup(){
}

void loop() {
  if (Esplora.readButton(SWITCH_DOWN) == LOW) {
    getTemp();
  }
}

void getTemp() {
 int theTemp = (Esplora.readTemperature(DEGREES_F)); 
// Serial.print(theTemp);
 int theTens = (theTemp/10);
 for (int i = 0; i < theTens; i++) {
   flashRed();
 }
 int theOnes = (theTemp%10);
 Serial.print(theOnes);
 for (int i = 0; i < theOnes; i++) {
   flashBlue();
 }
 delay (flashdelay);
 int brt = (Esplora.readLightSensor()/10);
 Esplora.writeGreen(brt);
 delay (flashdelay);
 Esplora.writeRGB(0,0,0);
}

void flashRed() {
  // uses room brightness to set LED level
  int brt = (Esplora.readLightSensor()/10);
 // Serial.println("bright "); Serial.print(brt);
  Esplora.writeRed(brt);
  delay (flashdelay);
  Esplora.writeRGB(0,0,0);
  delay (flashdelay);
}

void flashBlue() {
  int brt = (Esplora.readLightSensor()/10);
  Esplora.writeBlue(brt);
  delay (flashdelay);
  Esplora.writeRGB(0,0,0);
  delay (flashdelay);
}