I posted this to Flickr earlier this evening, but some people wanted to know how I did it so here you go:
If you are on a Mac the command you want to run to put a burger in your Bash shell prompt like mine is:
export PS1="\w 🍔 "
(which will eventually end up looking like export PS1="\w <U+1F354> ")
That string is \w for “current working directory”, a space, an emoji burger, and two more spaces for padding.
If you want it to be permanent put that line in your .profile or .bash_profile.
For my prompt I removed my system user name and host. People use those to know which computer they’re on and which user they are, but I know I am me and I am on the burger computer so I removed them. Here are some other options.
\d – Current date
\t – Current time
\h – Host name
# – Command number
\u – User name
\W – Current working directory (ie: Desktop/)
\w – Current working directory, full path (ie: /Users/Admin/Desktop)
How did your Code Year go? I hope well. But if you have unsubscribed from that mailing list or haven’t caught up to the lessons, I would like to share an idea I have for people who want to learn how to create things.
A lot of engineers have spent decades coding and building foundations for generations of engineers who follow them. Those new engineers stand upon the shoulders of those giants and build tools and frameworks for people who will follow them.
But because the tools have gotten so comparatively good to previous tools, especially for web and game development, many people have become interested in making applications themselves. And truthfully I think you can. I think anyone can, really. It’s not that hard. You just have to invest a lot of time learning how to hook one thing up to another, how services should work in the backend, and what design patterns you should follow to save time and complexity.
(Real serious computer science is something a bit different. I think when people use the word “coding” they mean “scripting.” But that‘s another blog post.)
Much to the chagrin of engineers it is as if they have been working for years to build flying cars and when they are finally here everyone is like: “Great! I want to build a flying car too!”
I think there’s an alternative and I would hope that you give this a chance. Instead of learning how to code, learn how to create with code. Learn how to make things with the abundance of tools out there available to you.
Twine is a desktop application (Windows or OS X) that gives you the ability to write interactive fiction. You can construct a story and lead a reader down a path based on their decisions.
If you want to get deeper into interactive fiction, with more coding concepts like variables and control flow, you can move on to Inform. Inform is the “Microsoft Word” for interactive fiction, giving you an array of tools to tell complex stories and bring in much more game-like interaction with your readers and players.
Maybe you don’t really want to tell a story, but are interested in making games for people to play. The first thing people do when presented with this is dive into a gaming framework like Unity3d or Corona.
Here is a better idea: there are a few iOS games out there that include level editors. Here’s one called King Rupert.
Making a game is more than just writing graphics handlers, it’s also working on the thing that makes something fun and enjoyable to keep playing. Level editors are a great way to immediately dive in and produce something other people can play with and give you feedback on. Here’s a massive list of them on Wikipedia.
And if you really want to build web sites, I say think about what it is you want to build and accept that there are a plethora of services that have worked out the hard parts and can probably provide all the work for you. Squarespace for portfolios or weblogs, Shopify for an online store, and for the more adventurous: If This Then That for any sort of “I wish x did y when z happened.”
Knowing how to program has been one of the most fulfilling skills I have acquired in my life, but I believe having the ability to ship something into the world for people to use is much more important.
For Christmas I put Snap Circuits on my wish list so that my son and I could start putting together circuits. He doesn't get most of it, but the little bits he does get (what certain components do, how things change when you disconnect certain wires) is enough for us to talk about things we want to build.
This past weekend was the first time he began reading and comprehending sentences. It sort of just happened. First he recognized the name of a cat in a book, and then the dog’s name, and then he learned “and” and various “oh”s and “go”s, and after that it just quickly built on itself. Watching this unfold over the span of an hour was one of the most amazing things I have ever seen in my life.
For my birthday a couple of weeks ago my friend Omar gave me a Raspberry Pi. I’d been aware of them since in 2011, but I never got around to buying one.
I’ve been toying with it the past few nights as I have had time. After buying the case above, I had to scrounge up a USB keyboard, then an SD card, then a monitor I could use that took HDMI input. At every turn it was some piece of tech I had discarded or at some point put away in a box. I didn’t even have an extra micro-USB cable so I am using the one that came with my Kindle.
But now that it is running I have fallen in love with this little computer. It is one of those things you think you understand until you actually get one in your hands and powered up.
Now I can play with these little ideas I’ve had, on a computer in my house, that didn’t cost $1,000, and only pennies to keep running 24/7. These are small ideas: a little Spyonit app I’ve been wanting but didn’t feel like paying an EC2 instance for, a big Twitter API idea that I have been toying with that will simply publish static pages to S3, and another idea I had about coordinating backups.
There is something indescribably pleasing about this thing. It feels like the time when I owned computers purely for fun. (And at 512Mb it has even more RAM than those computers.)
Many years ago I was sitting in my apartment watching television when my home phone rang.
“Hello?” “Hi, Mr. Torrez, this is your Visa card provider.” (Flashing red light.) “Yes?” “Could you help me by providing your credit card number to verify this is you?“ (Clanging alarms.) I read the number to the caller. “Thank you. In addition I also need your social security number to update our records.” (Explosions. Gunfire. Rocket powered grenades screeching over head.)
I still remember carefully relaying each digit as I walked around my apartment; eager to get this over with so I could get back to my show.
This was a very dumb thing. I was just a dumb person doing a dumb thing. Right now I can picture myself pacing around that living room, being my helpful self, while my identity was being stolen and I was the accomplice. I want to yell at myself every time I think about it.
The thing is: I knew this scam. I mean, I knew how these social engineering scams worked. As an even younger idiot I used to read about these scams in online message boards and think about how stupid people are.
I’ve been out of the hack/crack scene for many, many years, but in those days for every system actually subverted, many more were simply handed access by an employee just trying to get through their day.
If you knew the lingo and could speak with confidence you could get access to so many systems. For all the money invested in security and encryption, the weakest link was always the humans. Always go for the humans.
My friend Mat just suffered through the repercussions of a social engineering hack. Bravely recounting the possible loss of all his photos from the past year he had to also endure the mocking and finger wagging from people wondering why he didn’t have backups.
It is true: you should not only make regular backups of every machine, you should test your backups by regularly restoring your system. The only thing slightly less depressing than losing all your data is finding out your backups had stopped working months ago.
Mat knew full well he was going to endure that kind of scrutiny. He’s taken the hit for people who might have grown lazy over the past few years thinking their data was safe if it was in the hands of billion dollar corporations.
So thanks to Mat we are now talking about steps you should be taking to secure your data:
You might want to also use different credit cards for Amazon and Apple since this played a role in how Mat’s account was compromised. This is pretty much a bullshit fix you shouldn’t have to do. Thankfully Amazon closed that hack today. But who knows which other services will continue to provide this option?
Use a password management application like Lastpass or 1Password. There is a little bit of complexity in setting it up and it is almost unbearable without the browser plugins/extensions.
And by all means, if someone calls your house claiming to be from your credit card company, give them all the info they need. Their jobs are really tough and they just want to help you!
I just wrote the first one as a simple script that demonstrates how to do it with Twilio. If I actually had real free time I would build a little web UI where you could fill in the numbers, set a time, and get your own personalized conference room (with all the features you find in a regular conferencing system) to dial you and the participants when it’s time for the call.
But maybe that’s something you want to build?
The one thing I learned from this is Twilio is pretty damn cool. The documentation is good and the API is a good one.
I had a big day of coding last week and found myself flipping to Sublime Text to deal with a tricky multi-line selection. I was surprised to find out in the few months since I’d left Sublime Text it had received a multitude of updates and fixes. The tabs work and look better. It became difficult to switch back to Vico that day, and a this Monday when I needed to write a lot of code I went straight for Sublime Text.
Vico was very good and I was certainly faster. I could write code faster when I wasn’t having to learn a new keyboard command. And that was basically the problem, I got sick of learning. Yeah, I have to reach over and use the touchpad every few minutes while editing, but since I do that already in this (MarsEdit) and Google documents and any other edit window that is not Vico it seemed strange to have to switch my mind to vim editing.
Basically every night a set of scripts run that test whether all the things we know about Twitter: how replies work, how RT’s work, how URLs are shortened, how following works, and it publishes the results into a nice one page screen people can check in with when a new version rolls out.
In addition the data returned in JSON responses would also tip that there are new features to check out.
It reminded me of something I wish I could go out and buy right now. I want something the size of my Jambox but instead of an audio receiver and speakers inside, I want a tiny computer that is doing a number of things for me.
The first thing I’d want it to do is back-up files from our computers and then push them (delayed) to the cloud when I am at work or sleeping.
The second would be a web server I could use to develop apps for. I have these app ideas that I want to live in my house rather than on a server someplace I have to maintain. Things like address books and calendaring between my wife and I. Stuff I want to own, not depend on some outside service.
Don’t you want to buy that little box? I sure do.
Since I’m asking, another thing I want is an iPod Touch with everything it currently has PLUS a 3g data connection. I basically want my iPhone without a phone. Who needs to carry around a phone? (More on this later, maybe today).
But the really cool thing here is Berg Cloud. Well, potentially cool, since we’ve just seen video of it. But together they make me, a developer and lover of small, cute things, really excited. So excited that I checked out the price of thermal printers and found out they are staggeringly expensive.
But then I remembered I already own a thermal printer. A cheap one that prints labels. So I researched a little more and figured out how one could have their own thermal printer to hack away on:
Not as cute as the Little Printer, but appears to do the printing part of the equation. Mine prints pretty detailed stamps, so I think it should handle graphics like the ones that were in the demo. I haven’t gotten my hands on the continuous thermal paper yet, so I can’t say if the SDK will give as much control over printing, but it seems like a fun project if you’re looking for one.
After almost a whole month of using MacVim, I think I can safely say I’m a convert. Whenever I felt I was getting really good with it, I’d switch over to SublimeText and realize I was still much better at moving text around and editing whole blocks of code inside of a GUI editor.
Today after editing some code, I flipped over to SublimeText to realize I wasn’t working any faster, and in fact missed some of the quick delete commands like dt" or D I was so used to with Vim.
It actually took a bit longer than I thought it would take. Luckily anything you want to do you can find fairly quickly with Google and StackOverflow. Many times I thought, “It sure would be nice if I could do x with a vi command” and sure enough I’d type into Google “vi how to x” and there would be quite a few results explaining how to do it.
The other nice thing that happened is when I do work on config files on my servers I am now EXTREMELY good at it. Before this month I’d “sudo vi” an important config file and at some point “:q!” because I’d hit the wrong key. Now it feels so comfortable I think it’s made me a better admin.
One thing happened I wasn’t expecting on my road to Vim: I am not actually using Vim. Instead I’m using something called Vico which has many vi key-bindings but an entirely new codebase.
You can also import tmBundles and tmThemes if there’s something from Textmate you want:
MacVim always felt like a half-step toward OS X (requiring the Janus distribution and a fork with a file browser to fill in the holes) where Vico is solidly an OS X app. For example, searching with ack brings up a nice window reminiscent of Textmate:
But the most important thing is that it supports so much existing vi key-bindings that it doesn’t take long to go from (Mac)Vim to Vico. The only thing holding me back was the price: $39.99, but as the trial version was expiring I realized I wanted to use Vico past the trial date so I just bought it.
(Thanks to kob for pointing Vico out to me when I first started this project.)
After a couple days of using MacVim and not exactly liking NERDTree, I installed this fork that provides a very nice Mac-like file browser.
I also found out about an OS X application called Vico that attempts to merge the goodness of vim with the look and feel of a typical Cocoa application. It looks very nice, but also $40 so I am going to wait until I’m good with vim before giving the 15-day trial a spin.
Overall I’d say I’m back up to normal productivity, and it feels like every hour I spend with it I discover a new way to to do something.
Some friends were talking about National Novel Writing Month and since I don’t have an idea for a novel but felt like trying to accomplish something in November, I decided to switch my text editor to vim. Specifically MacVim which I think is an important distinction I’ll explain below.
Now, I learned vi back in college in 199ksjdfl and I use it regularly on servers because pico without an actual GUI to click on locations is cumbersome and most of what I need to do when editing server files is delete whole lines or replace a value or add a new line.
Since I already had a basic grasp of vi and people seemed to think they were more productive with vim, I figured it might be time to see if it would work for me.
Starting out I think I had three concerns:
I use file tabs and the file browser in my current editor Textmate a lot. So much that I didn’t think switching to vim would be able to address that given what I knew about vim.
I love my current theme Vibrant Ink, which I wasn’t ready to part with.
It’s confusing. And not in a way that I thought’t I’d never get it, but more in that I didn’t want to give up a week of learning to become only a bit more productive. I’m in the middle of a big project for a client and I didn’t want to be billing them for my slowness.
So last week I did some poking around and it turns out there’s something called ‘vimtutor’ already installed on OS X. I started it up and discovered I knew a lot more than I realized. If you’re on a Mac and have about a half hour you should try vimtutor right now. If you know a bit about vim already it will be a breeze. When I finished I knew I could keep going with learning vim so I did some more reading.
The next two things to really convince me I could do it was:
Finding out there was a Macintosh specific version of vim called MacVim that is a self-contained, windowed Cocoa application. This is good because there are some key-bindings in place that you are probably used to that don’t exist in standard vim. Hitting ⌘s in MacVim will actually save your file. You can use your mouse to select text and holding shift + moving your cursor around will select text.
Installing a vim distribution called Janus that installs a whole mess of plugins and tools that make transitioning to vim much easier. There’s a file browser (like in Textmate) and it even comes standard with the Vibrant Ink theme (type :color vibrantink) or set it up in your new .vimrclocal file by adding “color vibrantink” without the quotes. There are a lot of themes.
Back when I was younger there used to be this big debate about the meaning of the word “hacking”. In the News it was always used to describe unsavory acts of theft, vandalism, and destruction. Hackers (the nice kind) invented new words to help them sort the hacker from the malicious hack like “crackers” or “script kiddies” but I don’t think it was until the Maker-scene and Linus Torvalds and countless open source hackers took the word back and permanently gave it the definition it deserved.
Of all the books with the word “hackers” in it, the good one, aptly titled Hackers, did an excellent job at describing the early days of computing, all the way back to the Homebrew Computer Club and into the explosion and excess of the 80’s.
It is what I think of when I think of hackers. People who sit down to solve a problem or invent something for the joy of figuring it out or making it better for others. If they’re lucky, the thing they made gets used by other people. And if they’re really lucky they get a chance to create for a large and grateful audience.
When I was in college I made red boxes. Not a lot of them, but enough to keep my friends happy dialing home or around the country for free from pay phones. A descendent of the blue box the red box became popular when the former no longer worked on home telephone lines. As a kid in college (Berkeley no less) I wasn’t exactly hurting for money to call home. I was privileged enough (like my classmates) to have grants, loans, and parents willing to pay for us to attend a very good college so the $5 or $10 in phone calls a month wasn’t exactly breaking us.
And to be honest, who calls their parents that often?
The fun thing about red boxes was making them. Handing a newly soldered dialer to a friend (for a modest fee) was an amazing feeling. Here is a thing I made*, you can go use it as much as you want for whatever you want. I even scratched my business name into the back of them as I wrapped them back up in their boxes and plastic I was so proud.
I think my desire to make and share things with people who don’t have the ability to solder or code or install Apache was born in that dorm room. I ship code because it is tremendously satisfying to give people things that they can use. I am addicted to the feedback and especially the knowledge that I got it right. It makes me feel good.
And to be clear: you don’t have to necessarily know how to install Apache or solder a chip. All you need is a desire to make something be a way that it should or can be. And if you want to do it for a large audience you need to understand them and what they want. I spend a lot of time thinking about these things. “What do people want?” “How should this be better?”
My favorite people make tools for people. Not just make tools, but make them with the intention of others using and enjoying those tools. I appreciate something done well and it fuels my own ambition to do good work. I was very sad to hear about Steve Jobs passing away not because I love my Apple computers or worship my phone, but because I felt that we shared the same feelings about making things better for people.
That’s all I’m trying to do.
* Red boxes were usually Radio Shack tone dialers with a modification that passed the impulses through a crystal (soldered on the outside). The switch you see in my red box above allowed you to flip back to regular tone dialing if you needed it.
Most people in the position of offering people advice seem to gravitate towards prolonging people's need for that advice. It's fascinating to see someone realize that and struggle with what it is he's found himself the king of.
I was a huge fan of Merlin's site when he first launched it. I read the GTD book and noticed the more I developed my own homebrew system, the less I need these types of sites in my newsreader. Now everything goes into Taskpaper, and I just work my way down through the day. Stuff spills over, whatever.
There are three things I've always wanted to do: Learn Objective-C, make something for my iPhone, and make a game. I decided to do all three after posting about Cocos2d the other day.
So here it is.
A card matching game. Boring, I know, but that might have been the most fun I've had with this phone in a while. The game seems to bore the pants off anyone I show it to, but I am so in love with the thing I even played it on the train for a bit.
My first pass yielded a pretty simple demo of drawing on the screen with some game rules applied.
That felt too light and there were so many things I wanted to fix and change that I made a second version. But that version just made me want to really finish the thing off right so I added the spinning and cleaned up the graphics and icons.
And tonight I was thinking, MY GOD, I could really make this thing sing and then I snapped out of it. I'm done. The source code is here if you're into that sort of thing.
I am still new to Objective-C and I have no clue if I'm doing things incorrectly, but this is my first real project so I'd love to get any feedback on it. I think I got "synthesize" happy. I probably didn't need to do that.
And Cocos2d is excellent but again, I need to look at more code as the stacked layer structure with reciprocal pointers between them feels completely wrong to someone like me who makes MVC web apps.
I was offered the chance to buy a Chumby in what they're calling the insider release phase of Chumby sales. I can't decide if I really want to get one. At just under $200 it seems like a very large expense for what would potentially be a second monitor on my desk.
If I'm not sitting at my desk at work I'm sitting on my couch with my laptop. And if I'm not at either of those places I surely will have my iTelephone on me. While I'd love to write something for it, I'd much rather take the new Leopard dev tools for a spin or work on some super-sekrit project of my own that I will own.
Plus there seems to be some kooky licensing issues with Chumby that seems to boil down to "I can only GPL my work or they own it". A Chumby right now seems like an extravagant attention sink with little reward.
I probably could have milked that app a bit, but I've always shied away from charging for stuff which should just be free. When Firefox debuted with built-in search, I switched to it and forgot about Nutshell.
I have the problem where if something seems obvious and simple, I think it should just be free for the taking. Add to that the fact I refer to it as "a problem" and I'm sure there's a whole mess of missed opportunities in my past projects.
I sometimes query friends for feedback on my projects, but sometimes they are busy or aren't online. I decided to start a Google Group for those of us who make these kinds of sites to get support. A place for anyone with a new site idea to come and get feedback or help out others who are trying to launch a site.
As I state on the group's charter: A group dedicated to those of us who build web sites in our spare time for fun or profit. Discuss new ideas, feasibility, and get or give help to others.
A red box, for those of you not in the know is a device that allowed you to make free pay-phone calls. When a quarter was dropped into a pay-phone, five little tones were sent down the line to the central office telling them that a quarter was deposited (a dime is two tones, one tone equaled five cents). Through secret channels and text files the instructions were passed along.
It was so simple to build and use that it was almost a joke. Since I was in college I'd build red boxes for anyone who wanted to give me the $10 it cost to make one. I think if a hack like that were to come out now, it'd be routed around within a year.