• Tech Tips

    Delete Last Command from Bash History

    If you’re like me, on occasion you accidentally (or sometimes purposefully) include a password in a command. Until recently I would execute history , find the offending command’s number, then do a history -d NUMBER . It is kind of a pain.

    The following deletes the last item in your bash history:

    You can create an alias for this, type it manually (umm, no thanks), or, as is the case for me, create a Keyboard Maestro macro for it. Here’s what my macro looks like:

    img20141208190438

  • Development,  Tech Tips

    “Create Evernote Note” from Chrome Tab using Keyboard Maestro

    Here’s an example of a macro that creates an Evernote note out of the current Chrome browser tab. My goal was to just throw the current page into Evernote with its page title as the note title, and its URL as the source URL.

    Step 1: Build the macro as shown below. I encourage you to tweak the Applescript, but you may want to test with the Applescript editor first.

  • Tech Tips

    Chrome Extension: CopyAllURLs – Share all tabs in current window

    Have you ever wanted to share (or save-for-later) all of the tabs you’re viewing in a Chrome window? I highly recommend the CopyAllURLs extension. The configuration is easy and powerful, and it works very well to export/copy (and import/paste, which opens all of the links in your clipboard) all of the tabs. You are free to use HTML in the output, which is awesome. Copying all of the tabs and sharing them is a breeze, and the output looks great. Pasting into an email, Evernote, or whatever works as expected, preserving the links and formatting (if you enable the HTML mime type option). 

  • Tech Tips

    Grabbing Screenshots for a List of URLs

    UPDATE: There’s a better tool for this job. View my new post about Pageres.

    webkit2png is a great tool for taking automatic screenshots of websites. Here’s the project’s description: “With tall or wide pages that would normally require scrolling, it takes screenshots of the whole webpage, not just the area that would be visible in a browser window.”

    Here’s one way to use this tool to grab an entire list of URLs. First, make a file containing URLs, one per line. Next, simply run this (set filename, output directory, and options as needed):

    The “-F” argument will grab only a fullsize screenshot. There are many options to control sizing, filenames, scaling, and more. Run  webkit2png --help for available options.

  • Tech Tips

    Autocomplete in iTerm2

    This is a really quick tip that could save you tons of time in iTerm2. If you use any auto-completion you know how important it is to your workflow. Personally, I rely heavily on omni and generic completion in Vim.

    In Vim CTRL-N is the key combination I use after I start typing a word that I know exists somewhere else in the buffer. It pops open a menu where I can choose the match I want. For example, if I have a function called “agileadam_foo”, I can quickly retype that string by typing part of the string (e.g., agi) followed by CTRL-N. If it’s the only match it’ll complete the string, otherwise I can choose which string I want, or type another letter or two and try again. It all happens very quickly, and is almost always faster than typing the string in its entirety.

    You can achieve the same functionality in iTerm2 without any special configuration. The built-in key combination is CMD-; (command + semicolon). Here’s the description of the feature from iTerm’s Highlights for New Users guide:

    Any text that exists in a tab or its scrollback buffer can be autocompleted in that tab. To use autocomplete, type the beginning of a word and then press cmd-;. An autocomplete window opens showing the top 20 choices for words beginning what what you have entered. The list can be filtered by typing a subsequence. The filter can be reset by pressing backspace. If you make a selection and press return, it will be entered for you. If you make a selection and press tab, your autocomplete will be extended with the selection.

    I had a [not-so-] brilliant idea of mapping, in the Keys preference pane for the app,  CTRL-N to Select Menu Item… » Open Autocomplete… so that it mimics Vim. Unfortunately, as you might have guessed, it overrode the CTRL-N mapping in Vim. I guess I’ll stick to the default CMD-; for now.

  • Tech Tips

    Sorting ActiveCollab tasks

    Our company has been using ActiveCollab for years. It’s a great project management tool and has improved considerably over the years. We have managed hundreds of projects and more than 12,000 tasks using ActiveCollab. Occasionally we want a little more from the system than it offers out of the box. I’ve built an importer (shameless plug!) to make it simple to add tasks in bulk. I’ve written some automated task creation scripts. I’ve even tried my hand at writing a 3rd party integration module. Sometimes, though, you just need a simple tweak to tailor the system to your needs. That’s what this post is about.

  • Tech Tips

    GeekTool Tip – Restoring “lost” geeklets

    If you use GeekTool you may have experienced “losing” your geeklets offscreen.

    Run this simple Applescript to get them all back to a place where you can easily grab them.

     

  • Development,  Tech Tips

    Keyboard Maestro URL Handler – Link Injection

    Introduction

    This post outlines some advanced usage of the Keyboard Maestro URL handler (KMLink).

    A few weeks ago I was automating some Chrome form filling with Keyboard Maestro. It occurred to me that the perfect trigger for what I was doing would actually be a simple link within the Chrome webpage itself (or a simple bookmarklet); when the link/bookmarklet is clicked, the KM macro is executed. How about a little backstory before I get to the “here’s how to do it!” ?

    We use a project management system called ActiveCollab. It’s a great piece of web-based software, but often simple things take several steps. When I want to quickly mark a task as “Due in 2 business days” (which I need to do very often) it’d be whole lot nicer to click a link to set this, than to have to go to the edit screen, pull up the date picker, think about what two business days from today is, click that date and submit the form. Sure, I could write a module for Active Collab that would do what I want, but Keyboard Maestro provides me with much more freedom and I can build it in minutes instead of hours.

  • Tech Tips

    Customizable Date variables in Keyboard Maestro

    UPDATE: Though the solution below works well, I do recommend following the first commenter’s advice and using the ICUDateTime text tokens instead, which allow you to use any ICU date format, without having to invoke a shell script.

    Sometimes you need a date and/or time variable in your Keyboard Maestro macros. The easiest One way I’ve found to do this is via an “Execute Shell Script” action. You’ll just use the date command and format as desired.

    Keyboard Maestro "Date" Variable

  • Tech Tips

    Keyboard Maestro – It’s the Little Things

    I’ve been using Keyboard Maestro to make myself more efficient. Even the littlest things can (and should) be automated to save time.

    I spend a good portion of my day navigating directories in iTerm. Often I find myself jumping up a directory (back) and then listing the directories to get my bearings.

    In about 30 seconds I made myself a quick hotkey that will be active during iTerm sessions (it’s within my iTerm group, which is only active for the iTerm application) and will perform both operations (cd .. and ls). I mapped this to CMD-u which I think of as “up” so it’s easy to remember. Notice there is a return (linebreak) after the ls; this will simulate hitting return, which will execute the preceding commands. I could have added a return keystroke action, but this is just faster and requires less actions.

    I encourage you, if you’re a KM user, to think about the little things and figure out where you could shave off keystrokes, mouse clicks, etc. to make yourself as efficient as possible.

    km-cd-ls