Thanks to this post on the Keyboard Maestro forum:
Update:
Right click on any Finder item, then hold Option. “Copy” becomes “Copy as Pathname”!!— @masnick
(Thanks @anatomyofashane - you are a genius.)
Thanks to this post on the Keyboard Maestro forum:
Update:
Right click on any Finder item, then hold Option. “Copy” becomes “Copy as Pathname”!!— @masnick
(Thanks @anatomyofashane - you are a genius.)
From Dan Menes on the Stata listserv:
display _newline(200)
It doesn't technically clear the results window, but it does allow you to easily add a visual break in the results. I recommend putting this in a TextExpander snippet for easy access.
It replaces all .gif files with a photo of a kitten. It requires jQuery (for now).
I often click PDF links in Safari, and the PDF will open in that Safari window rather than downloading. This is ok with me. I don't like a bunch of files cluttering my ~/Downloads folder.
But when I do want to download one of these PDFs, there isn't an easy way to do it. There is no "Save As..." in the right click menu, and the HUD buttons at the bottom of the viewer are hard to reliably bring up.
Enter this Automator workflow, which I trigger with LaunchBar. It will download the file (PDF or otherwise) in the frontmost Safari window into the frontmost Finder window's folder, or to the Desktop if no Finder windows are open. Download it here.
Compiled from this Stack Overflow answer, here is the list of Ruby’s very useful %
operators:
%w()
creates an array from space-delimited strings (a b c
becomes [‘a’, ‘b’, ‘c’]
)%r()
is another way to write a regular expression%q()
is for single-quoted strings (so you can do %q(that's right)
without escaping the '
%Q()
is for double-quoted strings so you don't have to escape "
, but can do interpolation (%Q(#{1+1}) => "2"
)%x()
is a shell command
%i()
gives an array of symbols (Ruby >= 2.0.0)%s()
turns foo
into a symbol (:foo
)If you want to strip metadata from photos (e.g., location data from your phone's GPS), there are a few ways to do it:
There's another option for Mac if you want to use the Terminal: exiftool
You can get exiftool with brew install exiftool
, and then you can use this command to strip all the metadata from a photo:
exiftool -all= /path/to/file.jpg
You can verify that it worked with exiftool -a /path/to/file.jpg | grep GPS
. Try running this before and after the previous command, and you can see how the GPS info is removed.
I have added the following to my .zshrc file for quick access to these commands:
alias exifstrip='exiftool -all=' function exifgps(){ exiftool -a "$1" | grep GPS }
Go here to get the bookmarklet.
Here's the code:
var x = window.prompt("Search Amazon.com order history for:"); window.location.href='https://www.amazon.com/gp/your-account/order-history/ref=oh_aui_search?opt=ab&search='+encodeURIComponent(x);
I just posted the code I use at the top of every IPython notebook to GitHub: https://github.com/masnick/ipython-setup
It was somewhat difficult to figure out what to import (and the conventions for this) when starting with IPython. This setup file takes care of that.
It also has some additional goodies like my code toggle button and my method to display raw HTML inline in the notebook.
In any case, I recommend standardizing the contents of the first cell in IPython notebooks, saving this out to a file, and then using %load magic to bootstrap the first cell. (This is explained in more detail in the GitHub link above.)