Git Bisect Howto

157 days ago

My first 30 seconds of Searching didn’t provide this exact thing so I’m writing it down in hopes that I can find it the next time I want to use this spiffy feature. But first, what is git bisect even?

git-bisect – Find by binary search the change that introduced a bug

And how do you use it? Well it’s not that bad really. You start off with telling git you want to do a bisect (duh).

git bisect start

Then you need to tell it the last known good and bad commits.

git bisect bad HEAD
git bisect good superlongcommithashortag

Then tell it how to determine if the commit is good or bad. It uses the process return code and seems to not work so hot with spaces so I recommend creating a short bash script like so:

#!/bin/bash
bundle install && bundle exec rake test

Then you tell git bisect to get to work.

git bisect run ./myscript.sh

That’s it, it will narrow down on the busting commit in no time. At least, probably faster than you would.

Alex Conner

,

Comment

Easy noatime for Mac OSX

172 days ago

One of the quickest and easiest (and free) ways to get more performance out of your Mac’s disk subsystem is to disable atime. Atime is a filesystem feature that goes and writes down the date every time you access a file, so for every filesystem read you then queue a write to update the metadata of the file. While atime may be extremely useful on a fileserver where you may want to archive files that go unused for a significant length of time, I doubt it’s worth the extra I/O on your machine.

Disabling it isn’t a point and click operation, normally. Normally you’d have to write a little XML to run a command at startup to disable atime and put it in a special folder and reboot. But I thought that was just a little too much work so I made a .pkg installer that does all the work for you. I’ve been using it personally for several months with no problems. The only side effect is the “Last Opened” file metatdata won’t get updated.

Download

Alex Conner

,

Comment

Dropboxing - Pt 1

180 days ago

I have, for quite a few years now, had a technological issue that while I have had a solution for it have not been able to figure out how to implement it.

You see, my Grandpa runs a small business in a rural part of Kentucky, and there are a fair number of Excel spreadsheets and documents that he uses to run the business. This totals up to about 1.8 GB of data, and with Internet speeds down there that rules out using pretty much any web based solution for those systems. However, he also has 2 PC’s, one at home and one at the shop that should have access to these files. There’s a wifi link between the buildings, so bandwidth between the two places is plenty fast, but neither machine can be expected to be on 24/7 and even the wifi link goes down periodically so a shared folder on either system isn’t ideal. Also, he takes the laptop to Florida for 2+ months out of the year and would like to have access to the files there.

Sounds like a perfect case for Dropbox if I’ve ever heard one. Unfortunately I could never figure out how to seed the data fast enough. You see, the shop only really closes for a few hours overnight and uploading 1.8 GB of data at 384k takes a lot longer than overnight. Well, Dropbox has over the years added the features I needed to make this work.

My grandpa backs up with Mozy, so I am able to restore his files to my machine in Indy. I can now share a folder from his account to mine and upload the files over my 4 Mbps upstream connection with my laptop. Once that’s done I can take my laptop with me this weekend when I go to visit and connect it to the LAN and then install the Dropbox client on his computers and they will LAN sync from my mirror of the files leaving the Internet undisturbed. This should only take a couple of hours tops and then I can just move the directories from the desktop onto the restored backup and Dropbox will upload only the changes made since the Mozy backup.

That’s the theory anyway, we’ll see this weekend how it works in practice :-)

Alex Conner

,

Comment

Why Torquebox Matters

192 days ago

About a month ago I started really looking into jRuby because I needed a Ruby environment that would be happy on Windows. Since I’m never content to stop when I know just enough to do what I need, I continued learning more and more about jRuby and what it’s really capable of.

I was doing a proof of concept of some threaded code (sms delivery with Twilio) and found that there are a lot of things that aren’t really thread safe in Rails, and without the traditional Ruby environment where you can add services like Redis and Resque it becomes really difficult to scale an app beyond something fairly trivial.

Torquebox gives you the tools you need to build an enterprise-grade app (yes, I mean that E word) in Rails without a lot of extra work. The Torquebox team has done a great job building adaptors and for the most part it’s plug and play. They answer a lot of the “how do I do X” questions for you when looking to build a stable, fast application.

How do I have a fully redundant app environment?

Spin up 2 app servers, cluster them using a quick and simple command and deploy your app. Point a load balancer at it and make sure your database is redundant as well.

How do I load balance my app?

Use the Apache module. It automatically does all the magic you want for you.

What can I use for caching that will be available on all of my hosts?

Simple, use the built-in Rails cache, the template configures it to use the built-in magic key-value caching system.

How do I handle non-threadsafe operations?

Use messaging. They make it dirt simple and reliable to implement a single-thread receiver that can handle your non-threadsafe operations.

Is Torquebox (or jRuby) for everyone? Heck no. jRuby has it’s roots in Java and sometimes you have to reach into Java and do things. And sometimes you have to do Java Style stuff to work with Torquebox. In fact, it probably doesn’t matter to you. But if your building a project that needs to be fast, reliable and enterprisey I think Torquebox + Rails are one of the nicest options out there.

Alex Conner

,

Comment

WhatIsMyIP for Bash

194 days ago

I’ve periodically wanted to know my external IP address when troubleshooting network issues, parsing logs, etc since I’m usually behind a dynamic IP. Usually this ends up with me either logging into my firewall and checking the external IP there or using WhatIsMyIP.com, both of which are easy enough but I wanted something faster and a bit more elegant.

Since I live in the terminal anyway I figured I’d just add a little function to my Bash .profile to handle this. Turns out WhatIsMyIP.org automatically returns just your IP if you use CURL so this was quite simple. Here it is if you’d like to use it :-)

Alex Conner

,

Comment

« Older