May 2012
2 posts
Spammers and Random Numbers
Wacky anti-spam idea: detect usernames or passwords that belong to the same low-entropy PRNG sequence. What spammer bothers to reseed their random number generator between generating a new batch of usernames and passwords for their spam accounts?
May 8th
Sortbox — Organize your Dropbox →
I wrote this cool thing with Kanishka and Sid. It’s like e-mail filters for your Dropbox.
May 4th
April 2012
1 post
"The only real pitfall when coding without...
Omitting semicolons in JavaScript is OK for the most part except for when it isn’t: If you choose to omit semicolons where possible, my advice is to insert them immediately before the opening parenthesis or square bracket in any statement that begins with one of those tokens, or any which begins with one of the arithmetic operator tokens /, +, or - if you should happen to write such a...
Apr 16th
January 2012
1 post
2 tags
Web Based Truth Table Generator →
I wrote this a while ago, recently ported it to run on GitHub Pages: http://mustpax.github.com/Truth-Table-Generator/
Jan 23rd
11 notes
November 2011
1 post
Nov 19th
1 note
September 2011
2 posts
3 tags
Netflix, Qwikster and the impending introduction...
Netflix just announced that they are spinning off their DVD-rental-by-mail service under a new brand Qwikster while the streaming service retains the Netflix name. Many commentators have duly noted Netflix’s boldness in leaving its cash cow behind and looking to the future, a true example of a company facing up to the Innovator’s Dilemma. However, this latest change serves a purpose...
Sep 19th
51 notes
“Leadership is about taking risks, while management is about mitigating them....”
– Joshua Schachter on Hacker News
Sep 7th
1 note
August 2011
1 post
6 tags
Simple staging on Heroku
Not everything runs the same on production as it does on localhost so you need a staging environment to vet changes before making them public. When developing Piazza (on GitHub) we put together a simple workflow to manage production and staging deployments. Our app is built on the Heroku Cedar stack with Java and the Play framework but this workflow should be applicable to all other apps on...
Aug 31st
21 notes
July 2011
1 post
"Go the F*** to Sleep not funny"
From “Go the F*** to Sleep not funny” “She has good reason to be concerned about the message behind such a parody. Demarest was the prosecuting attorney in one of Oregon’s most high-profile child murder cases. […] Nobody is suggesting that there’s a connection between Adam Mansbach’s book and child abuse or child neglect.” Dear CNN op-ed author, I...
Jul 1st
June 2011
4 posts
3 tags
Lazy loading click handlers with onmousedown
Just today I was thinking about how annoying it is that Facebook redirects all outgoing links to an internal page. They do this to mitigate the spread of clickjacking worms and whatnot but I like to think I’m smart enough to not click a post titled “I can’t believe she isnt werring a bra LOL WORM!!” So I figured I’d write a quick greasmonkey script to switch the links back...
Jun 22nd
3 notes
3 tags
Well, not *that* interactive
I always alias rm to rm -i to prevent fat-fingered mishaps. This is usually too chatty if you try to recursively delete even a moderately big directory, so you have to go all out with rm -rf. I get chills every time I type that little f in there and it turns out the new version of rm from GNU coreutils allows an alternate interactive mode -I that will prompt you once for all arguments. It also...
Jun 16th
2 notes
One Instruction Set Computer VM and Assembler on... →
I wrote this with a friend for a Computer Architecture course final project back in 2005. It is one of the first significant chunks of Java I’ve written, which shows. The concept is still interesting though.
Jun 14th
HELO EHLO
Why is it that ubiquitous internet protocols can’t spell? HTTP’s got “referer”. SMTP has not one but two misspellings of hello.
Jun 12th
March 2011
1 post
Mar 4th
2 notes
February 2011
1 post
“When you’re young, you look at television and think, There’s a...”
– Steve Jobs in WIRED magazine, February 1996
Feb 2nd
January 2011
2 posts
3 tags
The origin of Unix file delete permissions
Unix file permissions fall into three basic categories, read, write and execute. Which one do you think controls file deletion? It’s probably write, right? Well, let’s test it: $ touch foo; chmod -w foo $ ls -l foo -r-------- 1 user group 0 2011-01-24 12:16 foo $ rm foo $ ls foo ls: cannot access foo: No such file or directory That’s weird, it looks like I successfully...
Jan 26th
2 notes
Jan 5th
1 note
November 2010
1 post
2 tags
Keep trying till you succeed with Bash
The following Bash snippet will repeat a command with the given delay until it succeeds. while [ "$?" -gt "0" ] ; do sleep 120 # delay in seconds between retries # insert command to retry here done Unix processes return integers when they exit. These values can be read via $? in Bash. As a matter of convention, a process that completes without errors will return 0, so by checking for...
Nov 10th
2 notes
October 2010
2 posts
Oct 25th
4 tags
Secure delete with rm on OS X
I discovered this gem in the rm man page on OS X the other day: -P Overwrite regular files before deleting them. Files are overwritten three times, first with the byte pattern 0xff, then 0x00, and then 0xff again, before they are deleted. So there you go rm -P will securely delete a file from your disk with minimum hassle (i.e. without having to through the Thrash folder). This might...
Oct 24th
7 notes
August 2010
3 posts
“The major difference between a thing that might go wrong and a thing that cannot...”
–  Douglas Adams, presumably talking about how distributed systems are more reliable since fault tolerance is baked into the architecture
Aug 14th
Aug 8th
2 tags
“My ability to decide how I feel about Wikileaks’ activities is totally...”
– Tomorrowful on MetaFilter (via Simon Willison)
Aug 2nd
July 2010
2 posts
1 tag
Co-worker: moved files
Co-worker: scourge of p4
Me: more like code, the scourge of p4
Me: p4 would be so happy if it didn't have to deal with the contents of files
Me: just the metadata
Me: who has what opened when
Me: it loves that
Jul 22nd
Jul 18th
May 2010
1 post
2 tags
Identity crisis
Web apps should look like great web apps. Not like 2rd rate desktop apps. As Rumi once said, either be as you seem, or seem as you are. Otherwise we get into this uncanny valley situation.
May 25th
1 note
March 2010
2 posts
3 tags
Game of Life Implementation in Erlang →
This is a Game of Life implementation written in Erlang. Each cell is handled by a single process and each process talks to nearby cells via message passing to figure out state. At the end of the simulation the cells send their final state back to the root node i.e. the process that spawned them. I tried to stick with Erlang conventions for recursion and whatnot, but there are some rough edges,...
Mar 24th
2 tags
Find file, cd to parent directory
For jumping around in elaborate source trees. Usage: cdto [search root directory] [case insensitive filename] If you just want to search current directory: cdto [case insensitive filename] Automatically appends * to search filename. Update October 10, 2011: There are some nifty cd related scripts in this assorted archive of shell scripts on GitHub. The CDPATH stuff is pretty neat.
Mar 9th
3 notes
February 2010
1 post
2 tags
Works as intended
See[Mike]Code is a nifty tool for conducting remote programming interviews. One of the comments on the site bemoans the potential downsides of asking real programming questions during interviews: The problem is often with the interview questions, for example: “Write a loop that counts from 1 to 10” or “What’s the number after F in hexadecimal?” As a web...
Feb 22nd
December 2009
1 post
Highcharts: Beautiful Charts in Pure JavaScript →
Beautiful pure JavaScript HTML charts. Doesn’t even use the canvas element from what I can tell, which means better IE support. Also, plenty of DOM nodes to attach even handlers to. Spending server cycles to generate raster images of charts is getting silly.
Dec 1st
1 note
November 2009
1 post
Nov 14th
October 2009
2 posts
Honor among developers: self-assessing...
There is a discussion brewing on HN today about measuring programmer productivity. Reg Braithwaite chimes in to ask a very pertinent question: Programmers talk about productivity all the time. They say they’re more productive with static typing or without it. With Ruby or with Java. … It seems every programmer I meet has strong opinions about when they are more productive and when they...
Oct 25th
3 tags
Push notifications in the age firewalls
In the world of client-server networking, web browsers are the ultimate clients. They are always sending SYN packets, but never receiving any. They are always establishing outgoing connections, but never get to listen to any ports. Due to the ubiquity of the web, we have built our networks around the need to browse. Most NATs will not let any incoming connection near the private subnet....
Oct 17th
August 2009
4 posts
Aug 18th
3 tags
Only Twitter can save us from URL shorteners
Twitter should make URL shortening moot by allowing a link to be included with each Tweet at a fixed character cost of 5-10 characters. Everybody hates URL shorteners. They slow down page loads, can frame your content, steal your PageRank and even drop dead without notice (and come back alive in a similarly suprising fashion). I mean, even Jeff Atwood thinks they are hack, and he’s a very...
Aug 17th
3 tags
How Dropbox saved my command line
I live in the command line across many Unix-like platforms and networks. I have two Mac laptops, two Linux workstations, shell logins scattered across the multiverse, and even a couple Windows VMs to boot. I’ve tried versioning my shell configuration files, but that requires me to check in/check out my changes across all environments. This turned out to be less than ideal. More manual...
Aug 10th
11 notes
3 tags
The poor man’s Bash Tab-completion
Bash has a built-in tab completion utility that sports an impressive array features and the ability to generate suggestions using complex logic. But what if you just want to add a static list of suggestions to a command? It took a little digging around the Bash manual but I finally found the magic words you need to add to you .bashrc file: complete -o default -W "list of space separated words"...
Aug 8th
2 notes
March 2009
1 post
3 tags
Add ellipses (…) to overflowing text content →
This is one of those rare moments when IE has a neat bit of CSS functionality that other browsers don’t have. Sure you could try emulating this behavior in other browsers with the onoverflow event handler, but it would be a hackish and fragile implementation. Minimalist standards documents aside, some pieces of functionality are best supported by the browser, like contentEditable.
Mar 5th
“Participants seeking to dodge troubles [related to derivatives] face the same...”
– Warren Buffet as quoted in the NY Times.
Mar 1st
February 2009
3 posts
Sita Sings the Blues →
Lovely animated film about Ramayana by Nina Paley, the complete thing is available online for free. via kottke.org.
Feb 28th
3 tags
Add your favorite editors to the Mac Finder →
I confess, I still use Vim for most of my text editing.
Feb 2nd
September 2008
2 posts
Sep 16th
Public interfaces and incremental improvement
Facebook just came out with their new layout. From what I’ve seen on the internets, most people hate it. I’m not a very heavy Facebook user, so maybe I’m not hitting all the use-cases that my fellow internet citizens are hitting. The only problem I can see with the new layout is that “info” and “wall” now live in separate tabs. Even this is pretty...
Sep 14th
August 2008
1 post
2 tags
Log analysis with MySQL
Digging through log files has got to be the least-sexy aspect of web app development. I’ve found that using MySQL makes this process a little less painful and easier to standardize. At the very least, you don’t end up with 5 perl scripts every time you try to analyze a particular piece of data that you can never reuse. Here’s the workflow that I’ve found to work well for...
Aug 11th
1 note
June 2008
1 post
Lego fun snacks →
Jun 22nd
May 2008
6 posts
Let me enumerate the times…
Sometimes you have to iterate over a collection and count the steps you’ve taken. For example, let’s write a really simple function that returns the index of the leftmost occurrence of a given character in the given string. def indexof(str, char): i = 0 for c in str: if c == char: return i i += 1 return -1 Or, we could write it as: def indexof(str, char): ...
May 24th
Is it OK to remove code you don't understand?
No. Should be obvious but we all do it. People are merciless (or, dare I say, reckless) when trimming Other People’s Code. I was reminded of this fact by a recently well publicized occurrence of let’s-just-remove-the-line-that-warns. First of all let me just say, yes, you should always check your warnings. They are great for catching your own suboptimal programming practices....
May 21st
Switch to new iTunes Library
Just hold down the option key when launching iTunes and you will be given the option to to use a different music library (or create a new one). One of my machines has an incomplete version of my music library, and I want to scrap the old library and get a full library from another machine. I first tried replacing the ~/Music/iTunes folder with the full library, but that resulted in some funky...
May 21st
“No Dashes or Spaces” Hall of Shame →
Sacrificing usability at the altar of laziness.
May 17th
Reading, it sure is crazy →
I want this shirt bad. Via Dinosaur Comics.
May 15th