All posts by Tom Chapin

Rust (game) – AutoHotKey Script – Click Middle Mouse to Run

In the video game, “Rust“, if you want to run you have to hold down both the SHIFT key and the W key at the same time. This has the unfortunate effect of causing hand cramps for certain people, so I whipped together this little AutoHotKey script so those people can simply hold down their middle mouse button to run:

To use this script, you will need to install AutoHotKey, then copy and paste the script into a text file. Save the text file on your Desktop as “rust_middle_mouse_run.ahk”, then double click on it to run it.

Alternatively, if that sounds like a lot of work, you can just download the compiled AutoHotKey script as an executable file, by clicking here (rust_middle_mouse_run.exe).

After launching the rust_middle_mouse_run script, you will have a green “H” icon in your system tray (where the script can be toggled on or off), and when you are playing Rust, your middle mouse button will now make you run!

How to Re-run RSpec Tests Again After Failures

In the course of working with Selenium and Appium via RSpec tests (while testing iOS apps), I occasionally was running into issues where Appium would lose its connection with the iOS simulator and the RSpec test would fail.

The test failures had nothing to do with the iOS app itself, or even with the RSpec tests. The problems existed somewhere between Selenium, Appium, and the iOS simulator. Something would just randomly break on one of those layers, and my code’s connection to the iOS siumulator would essentially be lost. The only way to fix this problem is to manually close the iOS simulator and re-launch it via Appium. After that, all the RSpec tests would proceed merrily along their way without problem… or at least until Appium glitched again.

As you can imagine, with a large test suite, this can be rather annoying. If the driver glitches halfway through, you end up having to reset everything and re-run the entire suite from scratch.

This made me wonder… Would it be possible to catch the random driver errors and random Appium glitches, then programmatically reset the iOS simulator and re-run the failing test?

My co-worker, Aimee Maher, and I did a bit of research and we came up with a solution, which I will share here. Hopefully someone out there will get some benefit out of it:

spec_helper.rb (partial):

Essentially, what we are doing is running each RSpec test inside of an “around” block, and if the example fails for some driver-related reason, we reset and retry (up to three times) before moving on to the next test in the suite. Nifty, eh?

Golden Bubbles

Just because something is finite or rare doesn’t necessarily make it valuable. That’s a classic mistake people make when talking about currency.

Something has “real” value when it meets an actual human need or a desire.

Food and water, for example, have “real” value, because you would die without them. Shelter from the elements (such as a house) may also have some degree of “real” value (although much of what people refer to as “shelter” is mostly them flaunting their social status in the form of unnecessarily large houses). Land has “real” value because you can do things with it (growing food, building shelter, etc).

Gold has been seen as having value for millennia because of its inherit usefulness. For starters: It’s a very malleable metal which is resistant to oxidation and corrosion. It’s also shiny. This makes it ideal for making jewelry. Where there are people, there are always going to be people who want to show off their social status, and rare jewelry has a way of fulfilling that social need.

In the modern era, however, gold is a little less useful. We have all sorts of composite materials and advanced metals that are perhaps just as functional as gold for many purposes.

So much of the world’s gold supply has been hoarded up in vaults and is not even being used for anything anymore. The fact that the average person can get along just fine without it in their everyday lives (and yet the price is insanely high) means that the value of gold is currently suffering from a giant perception bubble. People think it’s worth more than it actually is, and because it’s rare, the price goes up, and since the price keeps going up, people want to buy it as an investment vehicle, and so the price keeps going up, and so people want to buy more, and it’s basically just a cycle that feeds on itself.

Plus, there are all the people who currently own gold and want the value to keep going up, so they are constantly going out of their way to tell people just how valuable gold is (and how it’s a foolproof investment). For the longest time, all you had to do was listen to any major talk radio station and you would hear countless ads about how you should “invest” in gold and blah blah blah.

In my opinion, the price of gold in the past couple of years has basically just been a giant bubble that demonstrates humanity’s greed and complete inability to assess the true value of things.

You can ride these sorts of bubbles for a while, but they will eventually always crash.

Resources for Learning Ruby & Ruby on Rails

Over the past couple of months, I’ve been “hitting the books” pretty hard when it comes to Ruby and Ruby on Rails. Here are a number of resources which I have found to be useful and would recommend to other Ruby newcomers:

Tutorials/Guides and Documentation:

Screencasts, etc:

Good programs to code with:


Sublime Text 2

Github Tools:

Tower (mac)

Console Tools:

iTerm 2 (mac):

I highly recommend zsh (used in conjunction with prezto) for your shell

Piping find to cp to recursively copy files

I have a bunch of font files organized within nested folders (along with all sorts of other stuff like text files).

I want to copy *just* the .ttf font files from within all of the folders. They need to be copied to a flat folder on my desktop that is named “Font Folder” (with spaces).

This turned out to be a lot more difficult than I originally anticipated, due to the fact that some of the files had spaces in their names. None of the guides or forum posts I found would work. I must have tried ten different “solutions” before I finally figured this one out. The key, as it turned out, was to enclose the {} in quotes:

find . -maxdepth 3 -type f -name \*.ttf -exec cp "{}" "/Users/tchapin/Desktop/Font Folder" \;

For All The Redditors Out There

On, there’s a phenomenon known as the “Cake Day“, which is the yearly anniversary of a member’s original sign-up date. When this magical day rolls around, a little cake icon appears next to your name, and people usually tend to be more generous with their up-votes towards your content.

Unfortunately, if you are a member of, you will probably notice that it’s actually rather difficult to determine the exact date of your “Cake Day” (unless you actually marked your calendar when you created your account). Instead of showing your actual, exact sign-up date on your profile, Reddit just tells you a vague figure something along the lines of, “you’ve been a member for 10 months”. The actual day is hidden, which means that the only way to know if it’s your cake day is to log in every single day that month, post a comment on something, and look for the cake icon to show up.

I got to thinking, and I realized there had to be a better way! Surely the sign-up information for a member could be found somewhere and exposed?

Sure enough, I tracked down a dynamic JSON file on the Reddit servers which could be accessed remotely. The JSON file path is: (where you can replace “johnsmith” in the URL with whatever user you were trying to look up).

This JSON file contains a number of information items about the particular user, one of which is titled “created_utc” and happens to be a Unix timestamp (a date format which uses the number of seconds since the Unix “epoch”, or January 1, 1970, to represent an exact point in time). PHP has a number of built-in functions which can easily translate Unix timestamps into human readable formats (such as Sunday, October 31, 2010, at 22:54:24 UTC), and PHP also has some nice built-in functions for grabbing and parsing remote JSON files.

Using all of this knowledge, I whipped together a quick tool for looking up reddit user information (including their exact Cake Day). This web-based tool is free to use and can be found at

Ideas for Potentially Solving Highway Traffic

1. Variable brake lights that inform following cars as to how light/heavy you are actually pressing your brake pedal.

2. Sensors on the front of the car which monitor how closely you are following the car in front of you. When this information is combined with your current speed and the knowledge of average braking distances and human response time, a buzzer or dashboard light could notify you to increase your following distance.

Firefox 6.0 – Gray Colored URL in Address Bar

If you have upgraded to Firefox 6.0 recently, you might have noticed a change in your URL address bar.

Now, instead of the web address being in all black like you might have grown accustomed to over the past 10 years, the powers that be have decided it would be better to color all of the URL gray (except for the primary domain name, which still appears in black).

Firefox 6.0 Address Bar

I can see how this could be helpful to the ignorant masses who get scammed by phishing emails, but I’m a relatively intelligent internet user, and I have been browsing the net long enough to know what the primary domain name is in the URL without needing to have it colored different.

If you are like me and wish to set the address bar colors back to the way they used to be in prior versions of Firefox, simply follow these easy steps:

  1. In your Firefox address bar, type “about:config” (sans quotes), and press enter.
  2. In the filter search box, enter “browser.urlbar.formatting.enabled
  3. Right-click on the “browser.urlbar.formatting.enabled” line item in the listing and select “Toggle” to switch it to false

Firefox 6.0 Address Bar - about:config

Facebook Authentication and a Potential Security Risk

The idea of a “universal login” is not new by any means. Since the early days of the internet, many people have longed for the ease of having to only remember one login and password to access all of their favorite member-based sites.

Over the years, there have been a number of companies/organizations that have tackled this problem, and recently a couple of solutions have bubbled to the top in popularity. OpenID, Google Friend Connect, MySpaceID, and even the Twitter Login API have all been used as “universal login” methods which can be integrated with a web site.

None of these solutions, however, have even come close to the adoption rate boasted by the Facebook Authentication system. Practically everyone has a Facebook account these days, regardless of age, gender, education level, location, favorite web browser, email address, or internet provider! Facebook embraced this fact and built a nicely packaged authentication system which enables developers to integrate Facebook Authentication into pretty much any app or web site they can imagine. You can now find the Facebook universal login method in everything from iphone apps and desktop applications, to normal run-of-the-mill web sites.

This brings me to my point: Potential Security Risks

While logging into my Facebook account via all the different web sites and various applications which I use on a daily basis, I became acutely aware of a glaring security risk with the Facebook Authentication system. Basically, the way how Facebook instills a sense of security is via a recognizable blue bar which has a gray bar and diagonal stripes underneath it. This familiar imagery is displayed whenever you are asked to provide your Facebook login information. The idea that is consequently trained and reinforced in end-users’ minds is that the familiar imagery represents a genuine Facebook login screen. As such, if you are being asked for your Facebook information in a login popup, but the unique blue and gray bar is missing, you would immediately suspect that something was wrong.

Notice, however, that the Facebook URL is nowhere to be seen in the login popup. There is literally no easy way to verify where the contents of the login form are actually going. This is especially true in the countless iphone applications and computer programs which are making use of the Facebook Authentication system. A rogue developer could easily create a form which displayed the blue and gray bar, but that actually transmitted the login information somewhere else entirely (such as a database on their own server) before it sent the information to Facebook.

The exact same thing could be easily accomplished by any semi-competent web developer with 15 minutes worth of spare time. All they would have to do is make a mock-up copy of the legitimate Facebook login popup, but have it submit somewhere else entirely. The end user wouldn’t know the difference.

In summary: Facebook’s way of instilling a *false* sense of security via their blue/gray bar is totally flawed and easily exploited. They need to come up with some sort of method which enables end-users to verify the form’s authenticity before they enter their login information.