Scary (and not in the terrorism sense). The stock market is completely automated now, and this is all it takes to cause a major disruption.

Also, if even the AP can’t keep an account secure, what hope do the rest of us have? We need a replacement for passwords that’s safe and yet easy to use.




Game Genie



Linux - What to Learn First

Originally wrote this as a Facebook post to guide my brother, who’s been stuck in Windows-land for a long time and needs to learn some Linux for work…

I dunno why there still isn’t a single definitive reference I can point someone to… Too big a topic, I guess.

Step 1

Acquire a good reference. Ask around at the office - everyone will have a favorite book. Here’s a decent one I’ve used: Unix in a Nutshell - Fourth Edition. (Cheap older edition here.)

Step 2

Learn to ignore elitists who tell you you’re going to shoot your eye out. You don’t need to know everything - wait until you get stuck, and then Google the error messages you get. (In the bad old days you used to be able to erase your whole file system, but nowadays ordinary users aren’t given the kind of system permissions that would let them do that kind of harm.)

Step 3

Learn some commands. I spend the most time with these:

SSH: Get to prompts on remote systems. Learn this one inside and out, including passwordless login via public/private keys.

man: Bring up a manual page on any command. Reading manpages is itself an art, so find a good tutorial on fully understanding manpages.

bash: Learn this shell; it’s the most common. It will change the way you work with files forever. Learn how to pipe programs’ standard input and output. Learn how to redirect output to a file.

ls: List files and directories. Learn this inside and out.

find: recursively search the whole hard drive for files and folders.

xargs: run commands on the files brought up by ls and find.

chmod: Control who can read, write, and execute (run) files. This will cause you grief if you don’t know it.

scp: Secure CoPy. Transfer files. Combines with SSH to do it passwordless-ly.

rsync: Even more powerful copying tool. Again, combines with SSH.

less: Read text; something you’ll need to do a lot. man and other programs pipe output through less, so learning it is worthwhile. Especially learn its string search capabilities.

vi: If and only if you have to edit files while they’re sitting on a remote server, learn vi. It’s a pain, it’s counterintuitive, and you’re going to be expected to know it.

cron: Schedule commands to be run at a particular time of day/week/month/year. Look like you’re working hard when you’re not even at the office.

Step 4

Get a buddy. Until you have some experience, you’ll want someone to confer with on the best way to do things. If a local buddy isn’t available, get good at Googling and posting questions on forums like ServerFault.

…all that’s a bit much, I know. If you learn only two of those, learn SSH and bash. Any time spent learning these topics will pay dividends, even if all it does is save you time.



I brought some SNES games to Heatsync Labs’ Vintage Game Night in Mesa tonight…

Attendee: “Cool, Tetris Attack? You guys should be playing this one.”
Me: “You show excellent taste, sir. I bet you’ll appreciate this…” [I reach into a box to retrieve my prized Japanese import…]
Attendee: “Oh, did you bring Panel de Pon?”

…There’s no impressing anyone any more. :P



Try R!

The Try R course is out on Code School! All lesson content by: me! Badass remote executor (that shows your graphs in the page!) by Thomas Meeks. Challenge implementation by me, Adam Fortuna, and Casey Jenks. Sponsorship by O’Reilly, which means the course is free to you!

It takes about an hour to complete, it’s pretty fun, and you’ll learn a language that can help you present data in compelling ways. Hope you’ll go try it!

Try R



SVG Tweets and HTML5 Canvas Tweets are both a bust…

…can’t get ‘em under 140 characters (at least, not while doing anything exciting with them). There’s just too much boilerplate. I’m under 256, at least!

Canvas - Rotate and Scale

Paste this into your address bar:

data:text/html,<canvas id='c' width='999' height='999'/><script>c=document.getElementById('c').getContext("2d");for(s=1;s<99;s++){c.scale(1.1,1.1);c.rotate(4);c.fillText("☃",1,2)}</script>

Or, just click this link.

SVG - Animation

SVG animations are EXCITING! (Or, in the wrong hands, seizure-inducing.)

Paste this into your address bar:

data:image/svg+xml,<svg xmlns=''><g transform="translate(500,400)"><text x='-15' y='5'>SVG!<animateTransform attributeName="transform" type="scale" values="0;99;0" dur="0.3s" repeatCount="99"/></text></g></svg>

Or, just click this link.

Well, it was a fun experiment, anyway. And there may be techniques for shaving off a few bytes out there; I might cram something worthwhile into a tweet yet.



Time for the FAA to join the 21st century.

Sent at the encouragement of this LifeHacker article.

Date: Sat, 1 Sep 2012 15:00:08 -0700
Subject: Please allow electronic devices during takeoff!
From: Jay McGavren

Dear sir or madam,

I will not claim to have data regarding whether non-radio-transmitting
electronic devices (or even those that do transmit) interfere with
aircraft equipment. I’m sure the research resources of the FAA and
other institutions far exceed my own in that regard.

I can, however, tell you that what I hear as an ordinary consumer and
citizen from reputable news outlets is that they do not, and so it’s
really frustrating when I’m asked to stop editing code (I’m a web
developer who bills by the hour) and sit idle in observance of a rule
that I believe has no benefit for anyone. I can only imagine how
foreign visitors to the U.S. must feel.

Please, revisit the issue of whether electronic devices during takeoff
are safe - I believe the FAA will find that they are.

Jay McGavren
Scottsdale, AZ

I encourage you to send your comments as well! Copy-paste my letter if you need to (though we’ll both have more effect if you personalize yours a bit).



SVG in a URL!

Some folks were messing around with a “data:text/html” URL in Campfire (paste it into your address bar to render the accompanying HTML), which I hadn’t known was possible… Well, of course I immediately had to see if other MIME types would work, and the first thing I tried was SVG…

Raw form (copy-paste in your address bar):

data:image/svg+xml,<svg xmlns=''><g transform="rotate(50),scale(9)"><text>SVG in a URL!</text></g></svg>

Link form (uses entities for the angle brackets):

SVG in a URL!

Tested in Chrome, Safari and Firefox on OSX. If it doesn’t work for you (or is expected to be deprecated in the future), I’d be curious to know.



DeSmuME: Teaching programming skills by hacking Nintendo DS games…

I got my start in software development by picking up the resources I needed to solve the problems that were relevant to me. I figure the same will be necessary to capture my son’s interest.

Well, my son’s mainly interested in video games. So be it.

I spent a good part of my youth hacking NES games by re-writing small parts of the program via Game Genie. When I learned that the Nintendo DS emulator, DeSmuME, has a facility to search and write the game’s RAM to create new cheat codes, I sat down with Lenny for a hack session.

Here’s a video of him demonstrating our results, on New Super Mario Bros.

Almost everything in a video game’s code is controlled by numbers. Understand the numbers, and you begin to understand the program. We’re not there yet, but this is a great start…



Zip + RSync = Easy to Maintain, Easy to Download Collections

Most people who’ve used a command line know about the existence of the “zip” utility. It’s basically a scriptable version of the archive tools we all use in our file browsers. Hopefully most people also know about RSync, which brings a directory structure into sync on two machines by creating, deleting, and updating files as necessary.

What people may not know, however, is that RSync will transmit only the updated portions of a file if it already exists on the remote side. That means you can easily maintain downloadable .zip archives, so your audience can retrieve whole collections of files at once. (Say, of your favorite Creative Commons-licensed music, which is the example we’ll use here.)

We start with a command line to add MP3s to a .zip file:

$ zip ~/Documents/media/ \
/Users/jay/Music/iTunes/iTunes\ Music/Ghost/ccMixter/Lullaby.mp3

The long music path is for convenience - that way I can just drag-and-drop files onto a terminal. It’s a nice touch that the full folder structure is preserved (though I will likely want to strike the “Users/jay” directory at some point):

$ unzip -l ~/Documents/media/
Archive:  /Users/jay/Documents/media/
 Length     Date   Time    Name
 --------    ----   ----    ----
 3664924  06-26-11 00:58   Users/jay/Music/iTunes/iTunes

If we use “&&” to add on an rsync command, the .zip file will automatically be sent to the remote server if compression is successful:

$ zip ~/Documents/media/
/Users/jay/Music/iTunes/iTunes\ Music/Ghost/ccMixter/Lullaby.mp3 && \
rsync --verbose --compress ~/Documents/media/ \

In the output, we can see the file being zipped, followed by the rsync transmission info:

 adding: Users/jay/Music/iTunes/iTunes
Music/Ghost/ccMixter/Lullaby.mp3 (deflated 3%)

sent 3556109 bytes  received 31 bytes  78156.92 bytes/sec
total size is 3554835  speedup is 1.00

Keeping all this as one command allows automatic updates of the remote file as new MP3s are added:

$ zip ~/Documents/media/ \
/Users/jay/Music/iTunes/iTunes\ Music/DoKashiteru/ccMixter/Our\
Slanted\ Voices\ \(ft.\ Colin\ Mutchler\).mp3 && \
rsync --verbose --compress ~/Documents/media/ \
 adding: Users/jay/Music/iTunes/iTunes Music/DoKashiteru/ccMixter/Our
Slanted Voices (ft. Colin Mutchler).mp3 (deflated 1%)

sent 5043684 bytes  received 11377 bytes  306367.33 bytes/sec
total size is 8595106  speedup is 1.70

Those transmission sizes represent only the new MP3 that’s been added, not the whole archive. For example, if I add a small README.txt to the archive…

$ zip ~/Documents/media/ README.txt && \
rsync --verbose --compress ~/Documents/media/ \
 adding: README.txt (deflated 36%)

sent 1288 bytes  received 20521 bytes  3965.27 bytes/sec
total size is 11636110  speedup is 533.55

…note that only 1KB (of the now-11MB file) is actually transmitted. Updates to files in the middle of the archive likewise cause the retransmission of only that file’s zipped content.

This can of course be converted to a shell script, but personally I think doing it all at the prompt lends itself to ad-hoc, on-the-fly alterations. (I wouldn’t want a script sitting around for every collection I could think to post.)

And I can certainly think of a lot of things to share this way - Project Gutenberg books, Creative Commons wallpapers, your own photos, basically anything that you can freely redistribute. Some care needs to be taken with variance in licenses (I had to add attribution ID3 tags to some of the MP3s, for example). But generally, it should be possible to include the needed documentation in the archive alongside the content. (I am not a lawyer, this is not legal advice, etc. etc.)

I view this as vastly preferable to clicking though dozens of pages to manually download individual files. If you agree, I hope you’ll use this technique to start sharing your own collections!