Don't use the stock ruby on Mac OS X
Math doesn’t work correctly: > 212227119877294391 * 86400 => 359548130941076096 On non-broken rubies: > 212227119877294391 * 86400 => 18336423157398235382400 (This has something to do with Fixnums that are larger than 32 bits failing to jump to Bignums correctly. I do not know whether it affects other 64bit versions of ruby)
clojure first impression
I realized that I’ll never be able to finish inventing a programming language if I don’t learn a LISP first. So I’ve been playing with Project Euler with a Clojure repl, and … well, it’s not ruby and it’s not Haskell. But it has a lot of lazy data structures, so I decided to pretend I was writing Haskell anyway and see what happens. Here’s a...
In which I brainstorm about my first 3D fabbing...
OK, so (for @keystricken’s birthday, [hi, Mon!]) I made a thing (with the help of Shapeways’s Selective Laser Sintering machine) Which is really just a physical projection of a 3D model I made in CAD: which was really challenging since I had never really used 3D CAD before at all. after some flailing about, I came up with a process that looked like this: Draw something on...
A* is easy.
I’ve been trying to learn some old-school algorithms; the sort of things that CS people study but rarely come up at programming gigs. The thing is, descriptions of algorithms online tend to suck. and open source implementations of textbook algorithms tend to suck. So, I’m going to try to improve the situation. So, here’s my first attempt. A* algorithm in simple readable...
ruby String += considered harmful
In real code, we found a very, very slow loop. Changing two characters: += is about 100 seconds. << is around 1/3 of a second. Using += on a string creates a copy and then discards the original, while << allows the ruby interpreter to intelligently resize the buffer. The only gotcha is that << will mutate your string object, which means that it’s not safe to use on a...
organizations which design systems are constrained to produce designs which are...– http://en.wikipedia.org/wiki/Conway%27s_Law
Rogues are very keen in their profession, and know already much more than we can teach them respecting their several kinds of roguery. I love everything about this internet artifact I’ve found: http://en.wikipedia.org/wiki/Full_disclosure#History . Actually, I want you to have today’s snapshot of the wikipedia article - I suspect that eventually this page will get cleaned up into an...
re-open source development
————— Forwarded message ————— From: Markus Roberts <email@example.com> Date: Tue, Sep 14, 2010 at 1:57 PM Subject: [Puppet-dev] Oops To: puppet-dev <firstname.lastname@example.org> Funny story: as the number of developers working on Puppet and related projects at PuppetLabs has increased, the average distance between them...
I participated in the 2010 ICFP programming contest a couple weeks ago, and my team (“vorpal”) did the best of any team I’ve been on yet: 16th place. While I’m waiting for teammate Paul Berry to write a detailed retelling of our progress, it occurred to me that I want to share the most elegant function I’ve written in a long time: type Fuel = [[[Integer]]] ...
make vim stupider
I get frustrated when vim is too smart, especially when it reindents things without me asking. This is a minimal, dumb indent system that I might be happy with. We’ll see. function! SimpleIndent() return indent(prevnonblank(v:lnum-1)) endfunction function! MyO() let line = line(".") let i = indent(nextnonblank(line)) call append(line-1, repeat(" ", i)) call cursor(line,...
I always forget to add the "sign-off" line to my...
export EDITOR=cat while git rebase —continue ; do git commit —amend -s ; done
I’ve just created a new command for git, called git. It only does one thing: it calls git. So, if you need to fetch changes, instead of typing: git fetch Now you can type: git git fetch It even works recursively: git git git git git git git git git fetch git-git is available on my github at http://github.com/jes5199/git-git
Does Google Make Us Stupid?
Sysadmins and programmers have less in common than I realized.
So we’ve already reduced the code to the two hardest problems left in...
uploading to flickr with ruby
there’s been some serious bit rot in the flickr API libs for ruby. flickr is still suggesting this list of broken, abandoned libraries: flickr-ruby flickr.rb rflickr I found some random old blog posts about flickr_fu, and it seemed more OK but still unfinished, and still abandoned. But I’ve found that some good people have forked the project on github, and they have a version...
on Parsing Expression Grammars
Co-worker Markus Roberts wrote: PEGs are, to my way of thinking, a beautiful sweet spot in grammar space, a worthy peer of limited-lookahead and regular expressions, but like these they cover a specific range of the problem space very well, if you take them on their own terms, and will fight you every step of the way if you don’t. Trying to use a regular expression as if it was a broken way...