Hardscrabble 🍫

By Max Jacobson

jekyll 2

06 Sep 2014

I just finished updating my blog to Jekyll 2.0. It looks the same, but the code is nicer.1

The marquee feature is that Jekyll now knows how to compile Sass and CoffeeScript. I was already using those languages, but relying on a complex Guardfile to accomplish it. I’m pleased to delete that.

Like all files Jekyll processes, Sass and CoffeeScript files must have YAML at the top of them, though no YAML data is actually required to be there, just the hyphens where the YAML would go. That’s an awkward requirement which I hope goes away.

The other thing I got to delete was some boilerplate configuration in the head of every page and post, in which I would tell Jekyll that posts should use the post layout and pages should use the page layout, so it knows which layout to use. Now I just tell it which layout to use for posts and which to use for pages once in the global configuration file, which is much nicer.

The last new thing I want to explore is using GitHub-style code blocks. I’d prefer to use the triple backtick over the liquid tag. This is supposed to be possible but I couldn’t get it to work perfectly – code blocks were generated, but lost the syntax highlighting so I decided to leave it for now.

The creator of Jekyll, GitHub co-founder Tom Preston-Werner, recently left GitHub after being investigated about very unprofessional behavior. Four months earlier, the Jekyll project was distanced from him a bit when the source code was moved from his personal account to an organization account dedicated to Jekyll and related projects. This is normal and reflects that the project outgrew him, and that he’s not the main maintainer anymore. When Jekyll 2.0.0 was released, Preston-Werner’s name was buried in a wall of thank-yous.

I feel slightly weird using Jekyll because of who created it. I’m glad it doesn’t follow the naming pattern of toml and tomdoc at least.

  1. The diff says I deleted 3623 lines, but it’s not as amazing as that sounds because 3263 of them are from a CSS library that I realized I don’t use anymore. 

when your disk fills up, who are you?

06 Sep 2014

I got into technology in large part because I was drawn to the Mac community. I started reading blogs about apps and productivity. That occupied a lot of my mind during college in particular, when I was struggling with procrastination and wanted to find some silver bullet app to save me.

During that time I heard of a neat app called DaisyDisk which analyzes your Mac’s disk and breaks down exactly where your data is on your computer. It can help you remember about huge files you totally can delete or games you don’t play anymore and can easily re-download if you want to again. I had a 2006 MacBook with an 80 GB hard drive (the cool black one) that I needed to constantly bail files out of. DaisyDisk’s colorful, powerful interface was a life saver and, for me, a benchmark for how cool an app could be.

It was updated fairly recently and seems to still be great. I just re-downloaded and ran it on my 128 GB MacBook Air:

my daisydisk results

Fast-forward to a few months ago, and I’m at work as a web developer and my coworker comments that the disk on one of our production Linux servers is nearly full, and we need to find something to delete. I knew DaisyDisk wouldn’t work in the command line but didn’t know what to suggest. He remembered something called ncdu and ran it and I had immediate, rippling acid flashbacks to DaisyDisk! ncdu is a tool that runs totally in the command line with a nice interface and accomplishes the same goals and supports the same workflow:

  1. start the app
  2. wait while it analyzes your disk
  3. see your top-level directories sorted by how much disk space they use
  4. let you drill down and see the same for all sub-directories
  5. let you delete culpable files right from its interface

Here’s what it looks like:

my ncdu results

Kind of the same!!

It would have been hopelessly intimidating and weird to me a few years ago but for the me that I am today (someone who sometimes uses Linux) I can’t help but find it much cooler.

ncdu can be installed on a Mac via homebrew with brew install ncdu or on Linux with sudo apt-get install ncdu.

my newest git alias is git

06 Sep 2014

Adding aliases makes git a lot more pleasant to use. For example, I am too busy to write git status to find out the current status of my project so I did this:

git config --global alias.st status

and now I just write git st.1

I have a few other git aliases that I find helpful. They’re on my dotfiles repo here: https://github.com/maxjacobson/dotfiles/blob/master/.gitconfig

I want to share my newest one because it’s kind of weird and fun. It solves a problem that others might have, but I apparently totally do: I often write git , don’t hit enter, and then go do something else. Then I come back and I write git st and hit enter, and I see this output:

⇥ git git st
git: 'git' is not a git command. See 'git --help'.

Did you mean one of these?

I see this probably every day.2

I wanted a new alias that just kind of ignores the extraneous git. Most git aliases don’t behave that way. At first I tried aliasing git to nothing at all, but it didn’t let me. I landed on this:

git config --global alias.git "! git"

The exclamation mark character means this alias doesn’t refer to another git command; instead, I want to run an arbitrary bash command… which, in this case, happens to be git itself. Luckily, the git aliasing system doesn’t simply run the quoted bash command, but it passes the rest of the arguments along, so git git st now behaves the same as git st, not simply git.

I’m pretty happy with this. I have a nagging worry that it’s too weird to not have some unwanted side effects, and if I discover any I’ll update this post.

  1. btw: when you do that, it gets saved in a dotfile in your home directory called ~/.gitconfig. If you open that file you’ll see your name and email address too if you set that up (if not, check out GitHub’s page on that) 

  2. you might see different output, but hist is another of my aliases and it’s close enough to git that git thinks I meant it.