Josh Betz

Engineer, Automattician, Wisconsin Badger

Sublime Text 3 Packages

Since I recently switched from VIM back to Sublime Text 3, I thought I’d share some of the packages that I’m using.

While Sublime Text 3 is still in beta, it seems to be stable enough to use. That being said, many of the packages have limited or no support for Python 3 at this point, which is necessary for ST3. Some of the more popular packages have branches on GitHub dedicated to Sublime Text 3 support. You can install those packages through Package Control by first adding the URL associated with that branch as a repository. For example, “https://github.com/weslly/Nettuts-Fetch/tree/st3“.

First, since I came from VIM, I thought it would be nice to use Vintage. I’ve used Vintage in the past and haven’t necessarily loved it though. Luckily, while I was searching for other packages that have Sublime Text 3 support, I stumbled upon Vintageous which has been excellent so far. At this point it’s kind of the reason that I don’t want to go back to Sublime Text 2.

Package Control

I was very happy to find that Package Control works in ST3. There are special installation instructions that involve manually cloning the repository, but nothing too complicated. After the initial install process, everything seems to work like normal.

Theme

Since the theme and color definitions aren’t dependent on a particular version of Python, the old themes and color schemes should still work. As always, I’m using the Soda theme with the Tomorrow Night color scheme. For now, I’m using the Tomorrow Night Eighties variant because it’s so hipster. 😉

Languages

Like the themes, language definitions aren’t dependent on a particular version of Python. The additional language definitions I’ve installed are CoffeeScript and Sass.

Other

Lastly, I’m using a few other utility packages that just make life easier.

  • GitGutter: I used something similar to this in VIM and I couldn’t imagine life without it. Basically, it tells you what changes have been made to the current file since the last commit.
  • Alignment: The standard version of this one doesn’t work, so you’ll have to find a working fork. I’m using https://github.com/kevinsperrine/sublime_alignment/tree/python3 and it works so far. This one lines up stuff in your code. I primarily use it on long lists of variable definitions or similar blocks so that all the equals symbols line up, making the code easier to read.
  • Fetch: Another package that needs the correct branch to be manually added to package control at this point. https://github.com/weslly/Nettuts-Fetch/tree/st3 is what I’m using. Since it’s made by Nettuts, I’ll let them explain in their article, Introducing Nettuts+ Fetch.
  • SublimeLinter: While SublimeLinter theoretically works with ST3, I haven’t been able to use it so far. Even though I normally don’t have an issue missing semicolons and such, it’s nice to have a linter watching your code so you don’t waste time tracking down bugs based on syntax errors.

P2 Theme

After trying to sort out the best way to facilitate asynchronous communication for a group project, I was reminded of P2. This talk by Pete Davies at WordCamp SF this past year tells a very compelling story about why you should use P2 on your project. You can use it for free on WordPress.com or download it to run on hosted WordPress. It took all of a few minutes to sign up for a free WordPress.com site and switch to the P2 theme. After that it was all work.

Secure Shared Files with Hazel

Occasionally I need to send sensitive files to someone on the internet. I took a tip I once heard from Merlin Mann and built a script to automate this as much as possible. It requires Hazel and a cloud sharing service that syncs to your Mac. I’m using Dropbox.

The basic idea is to use Dropbox as a place to share files safely and automate the process with Hazel. We’re going to rely on long, obscure filenames along with randomly generated passwords and short availability windows to protoct our files. We can automate all of this through a couple Hazel commands and an Applescript.

The Hazel commands are set up as follows. The first one looks for any file or folder older than 7 days that is a zip archive and deletes it. This enforces our short availability window. You could make the window anything you like. The second command looks for anything that’s not a zip archive and runs the following Applescript on it.

https://gist.github.com/4686756

We generate a random password with openssl rand -base64 32 — this means we’ll get 32 random base64 characters. We also create a SHA1 hash of the file to append to the filename. After that, just zip the file with the random password and put the password on the clipboard. You can do more, like generating a notification when the script is done. I have a TextExander snippet that lets you fill in the filename and grabs the password off the clipboard.

Ideally, you wouldn’t send the password along with the link to document. Try to use two different methods to notify someone where the file is located and what the password is — even if it’s just two different email accounts on a separate server.

For now this won’t work with directories because the SHA1 hash of a directory is blank. An easy way to fix that would be to zip the directory first and then get the hash and rename the zip file.

Email

MG Siegler recently wrote about his choice to archive 50,000+ emails one night. And how he used that to decide to archive everyone once a week from now on.

A week ago, I came home after a long night of drinking and wanted to vomit. It wasn’t the whiskey. It was the email.

The way I deal with email is only slightly different from MG’s. The ammount of email I get is extremely tame, but I still think the workflow could help a lot of people. It’s something I’ve worked into after hours of listening to Merlin Mann, in various formats, speak about email and time management.

I use my email in very tight conjunction with Things. It could be any “to do” list style app. OmniFocus is another good one. I like Things for its simplicity.

There’s one rule that I have with email, only read it once. That’s not the perfect way to say it. Of course I read emails multiple times, but when I read and email there are three things that can happen.

  1. Junk. Delete.
  2. I can do this in a minute or two. Do it. Archive or Delete.
  3. I don’t have time to do this right now. Put it in Things. Archive.

When it’s something I don’t have time for, I’ll drop a link to the email in the notes field of Things if I’m going to need to reference it again. This obviously requires you have an active to do list that you keep up with. It might seem like you’re just pushing the problem out of email and into another list, but ideally your to do list is more organized that your email. If you read the same email six times before you do something about it, you were wasting your time the first five times. With a GTD type approach, you can quickly look at your list and know what needs to get done and what things you can currently do based on contexts.

This works for me with a small volume of email. I imagine it gets even better the more email you get. The more email you get, the more time you waste re-reading everything.1

MG writes about how relieving it can be to have the weight of 50,000 emails moved out of your inbox, to a place that you only ever see them when/if you need to. It’s funny because I’m the same way, though I don’t clear my RSS reader every night, it’s something I do regularly. And those red Push Notifications. I don’t think this is uncommon though.

It’s essentially out-of-sight, out-of-mind. I should have known this would be the case since I’m also obsessed with clearing my RSS reader every night (even though I barely use it anymore) and am a slave to clearing red Push Notification dots on the iPhone/iPad.

I only slightly disagree with the final point:

Read most of it. Respond to some of it. Keep all of it. But hide it. Then forget about it. And repeat. And repeat. And repeat.

I don’t keep all my email. There’s a lot of email that I know I’ll never need again. I delete them. Maybe you never get email like that.


  1. Now if Sparrow would only have an option to check my mail every hour instead of pushing it to me as it comes in. I know I can set it to manual, but that’s too hard. 

Virtualized Development, Part 2

This is a follow up to my post, Set up VirtualBox for Web Development, where I describe how to configure a VirtualBox VM with two NICs so that you can develop on a local VM wherever you happen to be. I’m going to describe how to enhance that with a shared folder between your guest and host operating systems so that changes can be immediately reflected with a need to “upload” them to the virtual server.

One of the advantages to working with virtual machines for development is having a sandbox to throw stuff in. Not having to install PHP or MySQL on your local machine is nice, and if something goes wrong, just wipe it and start over (or boot from a snapshot). But wouldn’t it be nice if you could save your files and have the changes instantly reflected on the VM without going through an app like Transmit? I’ve been working with CodeKit recently, and one of the nice features is that it will refresh the browser for you automatically when you save your changes, but if you have to “upload” the files to a VM every time you save, this feature isn’t quite as useful. So, let’s fix that.

A couple of things came together in an interesting way leading up to this post. I’ve been working with CodeKit for a few weeks and it had started to become obvious that my workflow was a little flawed. Uploading to the VM after every save was getting old, even with Dropsend from TextMate. I knew about shared folders between VirtualBox host and guest, but gave up after briefly looking into it because I didn’t know how to install Guest Additions via the command line.

Then, someone showed me Vagrant. It’s an awesome app for automatically provisioning “lightweight, reproducible, and portable development environments.” I had a problem with it though; my MacBook is old and slow. Part of the automatic process is using Chef to essentially set up all the apps you need to run your environment – PHP, Apache, MySQL, etc. Everything went smoothly until Chef started doing its thing, then the CPU would jump to 100% and everything would lock up. I could limit this to 75% of the the host’s CPU if I wanted, but that wasn’t the real issue. I never really gave it a chance to finish, but it took long enough that it would be completely impractical for me to wait that long every time I needed to provision a VM for a new project. So, back to plain VirtualBox.

Let’s do this already!

As I mentioned, there is a way to set up a shared folder between the guest and host – Vagrant does this automatically for you, which is the main feature I was interested in anyway. Once you have the guest OS configured the way you want it, it’s only a few steps to create the shared folder:

First, install Guest Tools.

sudo apt-get install dkms
sudo apt-get install build-essential
sudo apt-get install linux-headers-$(uname -r)
sudo reboot

After the machine reboots, go to the “Devices” menu and click “Install Guest Additions”. This will essentially add Guest Additions as a CD-Rom, just like if you were using a desktop OS, but you have to mount it manually. Then, run the Guest Additions setup.

cd /media
sudo mkdir cdrom
sudo mount /dev/cdrom /media/cdrom
cd /media/cdrom
sudo ./VBoxLinuxAdditions-x86.run

If you haven’t already, you’ll need to shut down the guest to add a shared folder in the VirtualBox settings. From VirtualBox, click on the VM you want to set up, go to “Settings”, “Shared Folders”, and add a new share. Then, mount it with the following, where “yourshare” is the name you gave the shared folder.

mkdir /path/to/mountdir
sudo mount -t vboxsf yourshare /path/to/mountdir

Now you can just save your files into that folder and they will be shared on the guest as well. Eventually, when I get a new machine, I’ll try Vagrant again. This works excellent for me right now though.

Resources

  1. The commands to install Guest Additions came straight from Michael Halls-Moore’s blog.

Update

Instead of mounting the shared folder directly to the path you need it at, you may want to use a symbolic link to take advantage of the auto-mount feature of VirtualBox. When auto-mount is turned on, the folder will be mount in /media as the name you set it up as in VirtualBox, but it will have a prefix of ‘sf_’ in front of it. To create the symbolic link, you would run the following command.

ln -s /media/sf_yourshare /path/to/mount