A worthless week

This has been one of those weeks where I’ve done lots of stuff. I’ve also failed to accomplish anything worthwhile.

The highlight of the week was on Wednesday when the city decided to turn off the water to install new meters in the building. We got warning letters stuffed in the doorframe on Monday. So it wasn’t a surprise. I thought about toughing it out. But then I decided that having a working toilet for those six hours would be a good thing.

There were several errands that I had been putting off. So I ran those. Safeway1, lunch Costco, and the fabric store easily kept me away from the house. I was able to come home to working water.

I’d rather have been told about it the day of. Knowing about it on Monday meant I had time to plan. This means I didn’t use my poor-concentration evening hours to take care of those little errands. I’ve found that if I start doing most anything during those hours I’ll be sucked in for the whole night.

This includes reading2 and most anything on the computer that doesn’t involve writing. Having a blog provides all kinds of fun “let me learn about that” distractions. This week was ripe with the last sort. They also were the kind that were easy to stay up late with.

I’ve managed to totally destroy my sleep schedule this week. This has cost me my morning hours. I’m not an early bird. I like to be up around 7:30-8 a.m. and be showered and fed by 9. I’ll get about four hours of productive time before lunch that way. The lack of sleep has caught up with me. Today I’ve been dragging for the whole day. My plan is to be in bed by 11 p.m. tonight.

I’ve come up with a few shortcuts that certain tasked easier.

Screenshots

I documented this in a post about using Hazel and AppleScript to process screenshots. Doing this requires a lot of moving parts. It’s also limited in what it does. This is partly because a basic AppleScript doesn’t have the chops to really process an image. There maybe ways around this. I wanted to stick with the built-in Image Events handler. So anyone trying it doesn’t have to have anything installed other than Hazel.

I wanted to get a better result so I started exploring other options. ImageMagick seems like the go-to option. It’s very powerful. Its power come with great complexity. I’ve never been able to make sense of it. But it seemed like the tool for this job. With nothing to lose but sleep, I dove in.

I had to install it before I could start. This is much easier to type than to do. There is no installer image. Either I use MacPorts or install from source. My MacPorts was seriously out-of-date. IM is a big install. I exercised the only sensible option and nuked it from space. IM installed without problems with a fresh MacPorts tree. Nothing too difficult, just time consuming.

ImageMagick

Here’s a sample of the syntax used the make this screenshot:

It only took all night to learn.
It only took all night to learn.

Most search results for IM help are useless. People have been confused by it for a long time. This clutters up the search results.

In the end the only thing that help was the documentation on the IM site. I also experimented a lot. I think I took more screenshots that I ever have. The result might be well worth the lost night of sleep.

Now when I take a screenshot, it’s automatically renamed, filed, resized, and dressed up with a border. The one above was done this way. They look nice and will have a consistent theme from now on.

Using most of the same logic, I also made a similar action to move images out of my downloads folder.

Of course a screenshot sitting on my hard drive doesn’t do anyone any good. Hazel can upload files as part of an action, but she only speaks FTP/SFTP and webdav. This blog is currently hosted on WordPress.com. For security reasons, all files have to be uploaded via their web interface. I understand why they do it. With that many accounts the potential for abuse is high.

I had previously read an article about screenshot workflow on MacStories. In it he talks about hosting the images on Rackspace’s Cloud Files. This got me thinking about image hosting in general.

Image hosting

If I ever move to a different host, the files have to also move. Different blogging platforms also have differing ideas about how to format permalinks and archives. The idea of migrating thousands3 of images to a new host is mind-numbing.

Hosting the smaller files4 (like screenshots) away from the blog makes a lot of sense. The links are now permanent. I can also upload a file, get the link back, and paste it into a post I’m working on. That way I avoid opening my browser just for an upload.

So I set off to learn about image hosting.

To test this out, I opened both a Rackspace and AWS S35 account for comparison. Neither service offers SFTP/webdav access unless I spun up a server to host the clients. I’m avoiding adding sysadmin to my list of duties at all costs. Having a server to maintain is out of the question.

Moving files around the Internet is not hard. It’s the reason it was built. But the difficultly goes up when the certain tools can’t be used for the job. Tools like SFTP and webdav.

I also looked into some other services. They either charged for providing a webdav interface to Rackspace/S3 or didn’t serve files directly.6 There are also apps that will upload to Rackspace/S3. But I didn’t want another app just for quick uploads.

Learning how all this works also ate up a lot of time. And sleep.

Ruby

Since both Rackspace and S3 have API access, I decided to look into writing an uploader program. It turned out to be easy. The problem was figuring out what I needed to learn.

I started with Rackspace’s documentation. They provide code samples in seven languages. I also found out the official SDK was a ruby gem named fog. I was happy to find out fog also can be used for AWS and S3. Now I was getting a handle on all this. I could see the result I wanted. I also didn’t know much ruby.

So last night and today was spent learning ruby. I also managed to write a working Rackspace/S3 interface. The actual talking-to-the-servers part was simple thanks to fog. Getting the file handling right took much longer.

The result

Then to get the final result, I hooked that program into an OS X system service. Now I can select an image in the Finder, choose my uploader from the services menu, and have the image whisked off to the cloud.

One nice addition was to have the program write the image URL to a file so I can have a thumbnail sheet of all my uploaded images.

The auto-generated thumbnail index.
The auto-generated thumbnail index.

This last part is going to be the real timesaver. Each image is linked to the cloud file, but the image shown is the local file. This way I can see the thumbnail and have the cloud link available. Even if I’m offline at the time.

This was the reason I went down this road. Now I can have the link to the image before I write a post. This is a huge time saver. I don’t have to mess with uploads and links in the WordPress web interface. I can copy the HTML from my editor and paste it in and be done.

I’m not including the code here. I’ll dedicate a full post to it later.

I'm tired like this.
I'm tired like this.

Now that I’ve wrapped up my adventures in distraction-land, maybe I can get back on my normal schedule.7


  1. I’ve started paying more attention to the expiration dates on my food. I bought a package of grass-fed beef last week. On Sunday I was going to make burgers. I found it had expired four days before I bought it. They were really nice about refunding my money.
  2. It was another two novel week.
  3. Not yet, but I have a year before renewing. So it could be.
  4. If I think a file will eat up a lot of bandwidth, I’ll put in on wp.com. That’s what I pay them for. Overall, I want to keep the number of file low.
  5. It was sitting empty. I also had to update the user profiles and get new keys. It might as well been a new sign up.
  6. For example, Box.com provides webdav access. But the files can’t be linked from the blog.
  7. Writing this post has been helpful in getting all of this behind me. I also feel better about the time spent now that I’ve laid out what I did.

One thought on “A worthless week

  1. Pingback: Word Count — Week 6 | Jennifer Mack

Comments are closed.