Open Favorite Tweets on the Desktop

I’m a big fan of IFTTT.com, but one thing I missed was the ability to take actions on Favorite Tweets. This was a limitation in the Twitter API, but they’ve just restored this feature, which means I’ll be actually using Twitter again.

What I was doing before was using IFTTT to email me any links in Tweets that I favorite. I use this when I’m using Tweetbot and see an article that I want to read later. Sure, there are services like Pocket, but I seldom use them. And emailing them to myself is fine, but it too is tedious. So I set out to make this a little more automated. Turns out this is pretty simple.

Here’s the IFTTT recipe:

IFTTT Recipe: Open link tweets on my Desktop

This recipe just saves the link in the tweet in a text file in ~/Dropbox/IFTTT/Desktop. Running cat $file | xargs open will open it in the browser. You see where this is going?…

Next, I created a Folder Action Script using the AppleScript Editor. AppleScripts tend to be a black whole, IMHO, so I immediately pass off the AppleScript to a simple Bash script. Yes, its probably possible to do this in AppleScript. I don’t care. If you get it working, I might care, but probably not. You can see the AppleScript and the Bash scripts in this gist:

Four things you’ll need to do:

  1. Copy the applescript to ~/Library/Scripts/Folder Action Scripts
  2. Copy the shell script to ~/bin and make executable with chmod +x open-starred-urls.sh
  3. Attach the Folder Action. In Finder, right-click on ~/Dropbox/IFTTT/Desktop (make it if its not there) and select Services –> Folder Actions Setup… With your AppleScript in ~/Library/Scripts/Folder Action Scripts, your script should appear in the list. Activate it, and make sure that “Enable Folder Actions” is checked at the top of the box.
  4. Profit

Once you’ve set it all up, go favorite a tweet and watch your life fall into place.

UPDATE: I created another recipe, and refactored this a bit so that you can use the same script with a bunch of different services. Here’s another recipe that does the same thing when I star an item in the iOS app Reeder, using the Feedly service:

IFTTT Recipe: Open Starred Items on my Desktop

Magic Trackpad + BetterTouchTool

For the past week, I’ve been using Apple’s Magic Trackpad instead of my mouse. I’ve used the Magic Mouse in the past, and though there were some things I really liked about it, I found that I was frustrated with all of the accidental gestures that occurred. But a couple of weeks ago, I worked with my team on-site and several of them were using the Trackpad and had great things to say. Work offered to purchase one for me, so I thought I’d give it a shot.

After spending a week tweaking this thing, I must admit, I can see the appeal. It definitely takes some time to adjust, and wouldn’t be recommended without the free app BetterTouchTool by boastr. The first thing you notice when using the Trackpad is how much larger it is than a MacBook’s built-in trackpad. Your entire hand can rest on the trackpad with room to spare. But early in the week I found my wrist getting tired because, by default, you can’t rest your hand on it like you can with a mouse.

This is where BetterTouchTool helps out.

BetterTouchTool allows you to create custom gestures to launch anything you like. The list of options is overwhelming, so you need to start with one or two simple gestures for the things you do most.

Early in the week I went about creating a few simply one and two-finger shortcuts. But by mid-week, when my wrist was tired, it occurred to me that if more of my gestures were four and five-finger shortcuts, I could rest my hand on the trackpad more naturally. It wasn’t until then that I really became a convert.

So here are the settings I’d recommend for getting started, should you decide to give this a try.

First, go into Apple’s Preferences under Trackpad and adjust some of the defaults:

I turned off the “Look up” because I accidentally was tapping with three fingers and never used this feature. It just looks up the word under your cursor in the dictionary. Not useful to me.

Then go into the “Scroll” tab:

I uncheck the Scroll direction natural. The default mode has always confused me. Lastly, go into the “More Gestures” tab:

  • I really like the two-finger scroll between pages (for back and forward in the browser), so leave that checked.
  • I uncheck the “Swipe between full-screen apps” because I don’t use full screen very often, and because I’m using that for something I actually do use (BetterTouchTool took precedence on my MacBook Pro, but I uncheck it anyway).
  • Uncheck Mission Control since we’ll be using that Gesture too.
  • Unckeck App Expose (because who uses that anyway)
  • Uncheck Launchpad (because Alfred is a better replacement)
  • I leave “Show Desktop” and use that one a lot.

Okay, now its time to setup some easy to use BetterTouchTool settings:

Here are the Gestures I would recommend for getting started (these feel the most natural to me). First things first, you want to be able to open this preferences pane easily.

  • Single Finger Tap Top Left: Show BTT Preferences

Next, you want to optimize getting around the browser:

  • Four Finger Swipe Up:  Home (beginning of the page)
  • Four Finger Swipe Down – End (end of the page)

So you are browsing a website, and you can use Apple’s two-finger swipe up and down to scroll up and down the page. But using four fingers to swipe up or down take you to the top or bottom of the page. Very easy to remember, and this encourages me to let my hand rest on the trackpad. It also works just fine in other apps like Sublime.

  • Four Finger Swipe Right: Ctrl – Tab

This also encourages you to rest your hand on the trackpad. What this does is allows you to switch to the next tab by just swiping your hand to the right.

  • Four Finger Swipe Left: Command H

This one is different. You may want to change this to “Ctrl – Shift – Tab” so that swiping to the left switches to the previous tab. But I found over the week that I wasn’t using it as much. Instead, when I swipe to the left, I have it hiding the current application. This gets used a whole lot more for me as I switch back and forth between apps a lot. Which leads me to the next Gesture:

  • Five Finger Swipe Left: Application Switcher

This one isn’t used as much as plain old Command Tab, but I found that I used it a decent amount, so thought it was worth mentioning. It just pulls up the Application Switcher so you can jump around a bit easier. My left hand usually stays on the keyboard anyway, so you may not want to bother with this one. Okay, the last one that I really used quite a bit:

  • Five Finger Swipe Right: Command Q

Try this out and you’ll see why I like it. You swipe all five fingers to the right and it closes the application in a way that says “I don’t have time for this application”.

You can also setup Tap Sequences, which were hit or miss – they didn’t always work for me, but when they did, it was nice.

  • Tap Sequence [1], [2], [3], [4] – Opens iTerm

In theory, I’d just tap my four fingers in succession and iTerm would open up. The reverse (going from pinky finger to index finger triggers F6, the keyboard shortcut I use to Hide/Show iTerm). Because it wasn’t super-reliable, I didn’t end up using it all that much.

Its worth mentioning that all of these were setup as “Global”, but you could just as easily limit them to specific apps. In the end, its best to start with just a few that you can remember and build from there.

Cheers!

Auto-Pin Url

Most browsers have a feature called “Pin Tab” which basically shrinks the tab down the the favicon. This feature has always been completely pointless to me, because really, what is the use of pinning a tab every time I open my browser?

Enter Auto-Pin URL, a Chrome Extension.

Just enter the sites that you’d like to have auto-pin, and it does the work. This actually turns out to be pretty handy for sites you regularly have open. It even supports things like chrome://bookmarks.

Open a Github Repo Quickly from the Command Line

If you are a sysadmin or developer that uses a lot of repos throughout the day, and you use Github, this little snippet will come in handy. No more opening a browser window and fumbling around trying to navigate to your repo. Just type gh anywhere inside your project path and a browser window will open your repo on Github.

For this to work, you’ll need to do two things:

  1. Copy the snippet to ~/bin/gh
  2. Make it executable by running: chmod +x ~/bin/gh
  3. Reload or restart your terminal, browse into a Github project, type gh and boom!

How to Get Better Battery Life on a MacBook Pro

We all know that lowering the brightness of your display increases your battery life dramatically. Here’s a truly awesome little free app that has actually doubled the battery life of my MacBook Pro. Yes, doubled.

Its called gfxCardStatus

“Graphics Card Status” does one thing and does it very, very well. The 2008-2011 MacBook Pros have two graphics cards. One takes up a lot of juice but makes your graphics pop. The other is much more efficient. How much more efficient?

Well, I had never gotten 5 hours out of my MacBook Pro, and at the time of this photo, I’ve been on battery life for a good half hour. Here is the beauty of this app:

  • When your MacBook Pro is plugged in, use Dynamic or Discrete graphics.
  • When your MacBook Pro is unplugged, use Integrated.
  • Oh, and change them automatically when I unplug.

This works so well. Now, if you’re doing something like Photoshop or video processing, you’re likely to see a difference. But if you are a sysadmin doing video processing then just plug in your power cord – this is the least of your worries. Here’s the menubar:

You’ll want to go into Preferences and make sure that you have it set to automatically switch when you unplug:

Download gfxCardStatus at codykrieger.com

How to Quickly Insert Passwords Anywhere

There are a lot of great tools out there for snippets, passwords, and clipboard management. But this topic is going to address one specific use case:

quickly inserting a password.

Sure, 1Password is an awesome password manager and I use it to store all of my passwords. But 1Password’s best (and sole) integration is in the browser. And I work in more than just browsers.

Enter CopyLess and CopyLess Lite

This guy rocks. CopyLess, at its core, is just a clipboard manager. You copy something, and CopyLess saves it in a list. While this is nice, and worthy of another post, the real draw here is in using the Favorites feature with hotkeys.

Copy a password, then open CopyLess and mark it as a Favorite by clicking the Pin icon. Repeat for all of your passwords until you have a list with the passwords you most use on the Favorites tab. It will look something like this:

When that is done, you can rearrange the order if you like. The first one in the list is “Favorite item 1″. Now you just need to open the preferences and set hotkeys for each password:

Once it is setup, from inside any app, even when you’re on SSH on a production box, you can just hit Command 1 (or a combination of your choosing) to insert the password. I use this thing all day every day, and it makes getting around a breeze.

Of course, the normal security warnings are relevant here: you’re storing your password in plain-text in an app that requires no password and has no encryption, so use security measures on your machine with production passwords.

Until 1Password implements a similar desktop equivalent, this is a very handy way to get around.

If This Then That

This one isn’t unique to sysadmins. But as a sysadmin, you have a lot of online accounts that sit in silos across the web. Silos are bad. Imagine if you could someone get all of those accounts talking to one another so that something you do in one silo triggers something else in another silo.

Enter If This Then That

This is one of those genius concepts that most of us saw and immediately said to ourselves “Why didn’t I think of that?” and “Why has it taken mankind this long to come up with something this perfect?”

Confidence in mankind has been restored.

Some terms:

  • Channels – these are the online accounts you want IFTTT to use.
  • Tasks – connecting A to B is done with a task. For example, if I star an item in Google Reader, IFTTT sends me an email with the link.
  • Recipes – these are just Tasks you’ve made public for the rest of the world to use.

After setting up some Channels, you can start creating Tasks to get your accounts to do what you want them to do. You don’t have to write any code, read any API docs, or anything else. When I get tagged in a photo on Facebook, it adds it to my Flickr account. Another task copies it to my Dropbox.

Here’s one I’ve been using recently: if I star something in Google Reader (which I normally do from the Reeder app on my iPhone) send me the link in an email.