Joe Maller.com

Links for April 13, 2005


Flickr Feed & Error Handling

Flickr’s down for an upgrade, and I didn’t build an error handler into the scraped together PHP script for parsing my Flickr feed. To do list item 34,242…

That’s quite a mess…


Links for April 12, 2005


Faster Trash Size AppleScript

For whatever reason my Finder sometimes takes forever to calculate the size of the Trash. That doesn’t include the clicks of opening a Trash window, selecting all, then getting info. Here’s a script which is much faster: Faster Trash Size (click to open in Script Editor)

Nothing special, just a quick AppleScript wrapper for this simple terminal command: du -h ~/.Trash | tail -rn1 | awk '{print "Size of Trash is " $1}'

It’s three quick commands:

  • du -h ~/.Trash
    Disk Usage, the “-h” flag reports sizes in human-readable values, the directory to report is ~/.Trash, which is the current user’s Trash folder. This dumps a size report for every item in ~/.Trash followed by a total at the bottom. That output is then piped out to tail:
  • tail -rn1
    Tail reads the end of files or the standard input, in this case the output of du. The “-r” flag reverses the output, then “-n1” prints one line. The output of this has only one line which looks like 2.9G /Users/joe/.Trash. That gets sent to awk for some simple formatting:
  • awk '{print "Size of Trash is " $1}'
    Awk is an amazing tool that I’ve only recently scratched the surface of. This particular command is a really just a simple echo statement which uses Awk’s column splitting ability to quickly split the output of du and tail. “$1” refers to the first column of the output, split on white space by default. I added a descriptive string to Awk’s print command to make the output a little more meaningful and prettier.

Headaches

Yesterday: Jury duty for the New York State Supreme Court in May.
Just noticed that WordPress’ auto-htaccess file broke my old permalinks. Lovely. That’s going to be fun to monkey around with. Probably won’t be fixed soon, definitely not before NAB.


Links for April 10, 2005


Links for April 9, 2005



« Previous PageNext Page »

random

14th St webcam