Tuesday
Jan212014

How to stop CrashPlan from continuously crashing

Thanks Andrew Ferguson for pointing me to this.

First, stop CrashPlan:

sudo launchctl unload /library/launchdaemons/com.crashplan.engine.plist

Now, edit /Library/launchdaemons/com.crashplan.engine.plist, changing:

-Xmx512m

to something larger

-Xmx2048m

And, then restart CrashPlan with:

sudo launchctl load /library/launchdaemons/com.crashplan.engine.plist

(May want to later go back and revert to a smaller memory size once the backup backlog is cleared out.)

Monday
Jan062014

Rotate portrait pages by 90 degrees in a PDF

The problem: I get huge packets of landscape documents that I need to scan. I'm too forgetful to set up a separate ScanSnap profile to turn off automatic detection of landscape versus portrait orientation. And, the ScanSnap software is good at detecting portrait versus landscape, but not perfect. I know all the pages should be landscape. So, I just need an automated way to rotate only the portrait pages.

The solution:

Saturday
Jan042014

Formatting short dates in AppleScript

I was updating some AppleScripts that need the current date as a string in my preferred format (YYYY-MM-DD). The way I've typically done this is to paste the following function in and call it:

    on todayISOformat() 
        set theDate to current date
        set y to text -4 thru -1 of ("0000" & (year of theDate))
        set m to text -2 thru -1 of ("00" & ((month of theDate) as integer))
        set d to text -2 thru -1 of ("00" & (day of theDate))
        return y & "-" & m & "-" & d
    end todayISOformat

For quick and dirty scripts that are only going to run on your own computer I realized there's a cleaner way to get it: reset your system's standard for the format of Short Date to be YYYY-MM-DD (vs. the default MM/DD/YY) and then in AppleScript call:

    short date string of (get current date)

Friday
Dec062013

OCR all PDF files in a directory using PDFpenPro 6

I wanted to OCR all PDF files in a directory in a scripted way. PDFpenPro 6 has a nice OCR engine built-in. I just needed a way to automatically apply it to a bunch of files.

A little bit of fumbling with AppleScript and voila, two scripts to do exactly this. The first acts on all the PDF's within a directory without recursively descending into directories, the second adds recursion.

In my case I'm cleaning up a bunch of old folders of scanned papers, so this is basically a one-time use case. Another very nice idea is to have a folder action that automatically does OCR on any PDF dropped into a specific folder, but I didn't need the extra complexity of a folder action.

Monday
Sep092013

WhatsObservable v0.1.0 uploaded to PyPI

From README.txt:

WhatsObservable is used for determining which minor planets (and comets) are observable at a given time from a given location on Earth.

WhatsObservable determines the locations of objects using the routines of PyEphem and the Minor Planet Center's Orbit Database. Note that at least for the time being the user must download this file separately and WhatsObservable will find it on disk.

The intent is to replicate the functionality available at the JPL Solar System Dynamics Small Body Whats Observable web page. The motivation for writing WhatsObservable was to provide this capability when offline and in an easily scriptable manner.

NOTE: The precision of PyEphem with the MPC Orbit Database is good, especially for dates near the orbital epoch, but is not nearly as good as what is available directly from the JPL Horizons System. Even near the orbital epoch errors of a few arcseconds are not uncommon. Use this tool at your own risk and if precision matters, refer back directly to the JPL Horizons System.

A typical usage is:

import datetime
from whatsobservable import minorplanets

objects = minorplanets(datetime.datetime(2013, 9, 1, 10, 0),
                     568,   # 568 is the observatory code for Mauna Kea
                     max_objects=5, max_magnitude=12., max_zenithdistance_deg=60.0)
print objects

Note that the return is a pandas.DataFrame

You can install whatsobservable with:

easy_install whatsobservable

Or, by downloading from PyPI.

I've also put the source code on GitHub.

Page 1 ... 3 4 5 6 7 ... 32 Next 5 Entries »