Online Cron-Tab Generator

In the UNIX world, few things are more confusing that cron tab entries.

What does 0 8 * * 2 even mean? What are those columns again? The third column is day, isn’t it? Does that mean it runs every day? I don’t even…

Today I found Crontab Code Generator.

It lets you choose each column in a slightly more user-friendly fashion and then spits out a line you can paste into the cron tab file.

I’ll be sleeping easy tonight.

BASH script to delete mac extended attributes

Sometimes when you download lots of junk from the internet, MacOSX likes to stomp all over your files leaving pesky little sprinkles of annoyance called “extended attributes”

They show up when ever you ls -l as little @ symbols at the end of the file mode section.

Terminal
[~/tmp] [17:06:17 mburke]$ ls -l total 40 -rw-r--r--@ 1 mburke staff 18946 Sep 24 17:05 image-from-internet.png

Overcoming Ruby Error digest/sha1.bundle Library not loaded.

I ran into trouble the other day running rspec on my project. It had been working just fine the day before, but all of a sudden:

/Users/mburke/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/i686-darwin12.3.0/digest/sha1.bundle: dlopen(/Users/mburke/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/i686-darwin12.3.0/digest/sha1.bundle, 9): Library not loaded: /opt/local/lib/libcrypto.1.0.0.dylib (LoadError) ..snip ..

Apache ProxyPass and Cache-Control

website.conf
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule headers_module modules/mod_headers.so ProxyRequests off <LocationMatch "/s3/"> ProxyPass http://s3.amazonaws.com/your_bucket/ Header set Cache-Control "max-age=290304000, public" </LocationMatch>

Keep Your Framerate Out of My Physics - Part I

Never let your physics simulation depend on something as unreliable and capricious as the machine’s framerate.

When I was building Electric Field Hockey I used window.requestAnimationFrame to control the time-step for all the physics calculations.

Simulation Tick Function
Simulation.prototype.tick = function(frame) { var ts = frame.timeDiff / 1000; var puck = this.puck; var force = puck.charge.calcForceFrom( this.charges ); var newPosition = EFH.Physics.calcPosition(puck.charge, puck.velocity, force, ts); puck.velocity = EFH.Physics.calcVelocity(puck.velocity, force, ts); puck.moveTo(newPosition.x, newPosition.y); }; var init = function() { /* SNIP */ self.anim = new Kinetci.Animation(function(frame) { self.tick( frame ); }); };

It’s easy and straight forward: every time the browser wanted a new frame, we can calculate the forces, apply them to the objects, and figure out the new positions.

But it’s also simplistic.