Mac Screenshot Destination Changed

A co-worker showed me that (on the Mac) you can move the destination of screenshots (e.g. ⇧+⌘+4) from the desktop to another location. I am going to touch on a number of things all at once in pursuit of doing this very thing:

  1. make some assumptions
  2. create a new screenshots directory in a hosted storage solution
  3. link to that directory using a symlink (symbolic link [ln -s])
  4. change the default OS behavior to push the files out to that hosted storage directory
  5. follow up with housekeeping and related information

1. We will first assume that you are using a hosted storage solution like Google Drive. Some other options might include OwnCloud, DropBox, Copy, or Cubby.

2. Let’s create a new directory in Google Drive for your images (~/Google\ Drive/Pictures/screenshots). In terminal, enter the following:

cd ~/Google\ Drive
mkdir Pictures
cd Pictures
mkdir screenshots

3. At this point, let’s create a symlink (symbolic link) to screenshots:

ln -s ~/Google\ Drive/Pictures/screenshots ~/Pictures/screenshots

4. Now, let’s change the behavior of Mac OS X to write those screenshots to that new location in your hosted storage (or wherever else you determined to do it):

defaults write location ~/Google\ Drive/Pictures/screenshots/

4.1. And in order to get the behavior to kick in, kill the SystemUIServer:

killall SystemUIServer

5.1. ⇧+⌘+4 or ⇧+⌘+⌃+4 will do a selective/partial capture. But pushing the space bar afterward (⇧+⌘+4,˽ or ⇧+⌘+⌃+4,˽) will allow you to select a single window (like alt+PrtScrn in Windows).

Additionally, there is much more about screenshot capture tweaking on TekRevue. It includes things like disabling the default drop shadow, renaming the files and changing the file format.

Sublime Text Preferences

~/Library/Application Support/Sublime Text 2/Packages/User/Plain Text.sublime-settings

  "tab_size": 5,
  "translate_tabs_to_spaces": false

~/Library/Application Support/Sublime Text 2/Packages/User/Preferences.sublime-settings

  "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
  "default_line_ending": "unix",
  "font_size": 12.0,
  "show_full_path": true,
  "tab_size": 2,
  "word_wrap": true,
  "translate_tabs_to_spaces": true,
  "draw_white_space": "all"

From Rome to Arabia with Love: Numeral Conversion in PHP

Andy Bailey answered the age-old question on StackOverflow:

How do you convert a Roman numeral into an integer in PHP?

And the answer is, drumroll, please…

$romans = array(
    'M' => 1000,
    'CM' => 900,
    'D' => 500,
    'CD' => 400,
    'C' => 100,
    'XC' => 90,
    'L' => 50,
    'XL' => 40,
    'X' => 10,
    'IX' => 9,
    'V' => 5,
    'IV' => 4,
    'I' => 1,

$roman = 'MMMCMXCIX';
$result = 0;

foreach ($romans as $key => $value) {
    while (strpos($roman, $key) === 0) {
        $result += $value;
        $roman = substr($roman, strlen($key));
echo $result;

Thank you, Andy.

Some Thoughts on “How Google Works”

I have been reading “How Google works” by Eric Schmidt (CEO) and Jonathan Rosenberg (SVP Products). Working in a tech company, I find many of the insights valuable. It is (as the title may suggest) written for managers more than in-the-trench developers, etc. Notwithstanding that, it is a valuable book for most anyone in the field. This is not a review. It is a gleaning of thoughts from the book. These are some of the things that seemed important enough to me that I should take notes on it. So, what follows are some highlights.

As a quick note, you can find this book on Audible. And here is a link to get two free books on Audible. I am not getting a commission for either of those. But when I found the two book deal, I almost kicked myself, because I had just started using Audible in the previous month. Anyway, … Continue reading Some Thoughts on “How Google Works”

Nothing to Hide? Why Encrypt?

My daughter asked me earlier this year, “Papa, if you aren’t doing anything wrong, why do you want to obfuscate your email traffic?”

Actually, I am sure that she did not say obfuscate, but her point is the same: If you are not doing anything wrong, why would you want to hide the contents of your online interactions? So, I did what any good dad would do, I answered her question with a question:

Continue reading Nothing to Hide? Why Encrypt?

Vintage Mode in Sublime Text

While using Sublime a co-worker and I were talking about using ‘vintage’ mode in Sublime and its shortcomings on Mac. Namely two: it starts in edit mode, and it does not support key repeat (e.g. kdoesn’t move your cursor up the page more than once per key depress).

So, in case you aren’t there already, you can get into vintage mode thus: modify your User Preferences file (⌘+,) commenting out the “Vintage” line in the ignored_packages object:

    // "Vintage"

While I haven’t solved the first problem, I found a solution for the second. In terminal, enter:

defaults write com.sublimetext.2 ApplePressAndHoldEnabled -bool false

That cat is half-skinned. I may come back to this later.