 I'm Amy Wobowo, and I'm a software engineer at Airbnb focusing on international growth, and today I'm going to talk to you about knitting. Now, before you leave the room, because you think you must be at the wrong conference, I'm going to reassure you that this presentation is also about hardware hacking and problem solving and even has some code. You're just gonna have to wait to see how. So all stories start with an inspiration, and here is the somewhat unexpected inspiration of this particular journey. A couple of years ago, a video game review site called Kotaku published an article about Super Nintendo add-ons that didn't quite make the cut. You've probably heard of some of the more outlandish Nintendo peripherals that did make it. There was a baseball bat for playing baseball video games, a golf club for playing golf games, a super scope wireless gun for shooting games, but you might not have known that Nintendo was seriously contemplating making a knitting add-on. And here is the proposed advertisement for this knitting add-on, complete with horrible puns. I'm not sure if you can see, but in the bottom left corner, it says, why needle the competition? So the interface would be like Mario Paint, but instead of just pictures as output, you'd get your design on scarf or mittens. So most of the comments left on the Kotaku article were along the lines of, lol, we can totally see why this didn't get made, or what were they even thinking? But I had a totally different reaction to this article. And it was that I was super disappointed. I was so sad that this was never made because I imagined having one and using it every day. I had never wanted so badly for something to exist. So I did some research. I wanted to know if Nintendo had ever made any prototypes that I could get my hands on, if anyone else manufactured home knitting machines that were programmable. After a lot of research, it turned out that in the 1980s, a few companies made home knitting machines. There was a whole line of electronic knitting machines by Brother, but they were discontinued because they lost popularity. And that's when my dream was born, to get my hands on one of these machines and make something like the Nintendo knitting add-on that never was. And as fate would have it, there was one on sale on Craigslist, an hour and a half drive away from where I live. It was old, it was missing a lot of parts, but it was a start. It was the start of my dream. And this is the dream reiterated in cartoon form. To start with images, to send them to a knitting machine and to get sweaters with those images on them at the end. Basically, to create a networked yarn printer. So now that I had my knitting machine, the first step was to learn how to operate the damn thing. Because this is what a knitting machine looks like. It has a row of 200 needles. And to produce a piece, you first start by individually threading which needles you want threaded, depending on how wide you want your piece. The needles move in and out. You can thread up to two different colors of yarn. And if this is what a knitting machine looks like, this is what using a knitting machine feels like. There are so many buttons and so many moving parts. And it comes with a thick manual with super unfamiliar terms. And I wondered or I worried that if I pressed the wrong thing that this would happen or at least that I would break some of the needles and I would have no idea how to fix it. Luckily, I had a team of people with me that was both fearless and inventive while learning how to use this knitting machine. So this is the team of Airbnb engineers that helped me at last year's December hackathon to help hack the knitting machine. So Airbnb hosts two internal hackathons a year for the entire product team, designers and engineers. But wait, Airbnb hackathon, you ask. What in the world does this have to do with traveling? So I asked the hackathon organizer. I showed him this machine that I was really excited about having bought and asked if it was a valid hackathon project to hack this knitting machine. And he said, well, the spirit of our hackathon is about making awesome things and so is the spirit of our engineering culture. So sure, go ahead. So we had permission to work on this as a hackathon project. And I had no idea if anyone else would be as excited about this project as I was. So I gave my pitch to my coworkers and I was so surprised that there was so much interest in it. The people who came up to me saying that they wanted to help work on this were as excited as I was or more. And there were so many different kinds of engineers that signed up to help work on it. An iOS engineer, an SRE engineer, a performance engineer, a data infrastructure engineer, a front-end engineer. So in short, a bunch of engineers who had nothing, who had no experience with knitting or machine knitting. But we were all super excited about this project and it was actually one of the best teams I've ever worked on. And I think that it was partly because we had zero ego invested. None of us considered ourselves knitting machine experts or wanted to make sure that our ideas were used over other people's ideas. And it was just kind of a wild adventure that we were all in together. So back to Jabba the Hut. The reason we had to be fearless was because the knitting machine was a really daunting problem and we had no idea how to use it or to get it to print images that we sent to it. Inventive because this was 1980s technology and some of the parts were missing and we had to MacGyver replacement parts. But the good thing about being an engineer is that you can apply all of your problem-solving skills to any problem, including knitting. So this is an example of a problem that we had to be inventive to solve. And it felt like we were encountering problems at every corner, even before turning on the machine. So when you buy yarn at an art store, it will usually be in a ball or twisted up into the sky. But if you feed it to the machine, you want it to feed into the machine evenly and smoothly. So you want it more like a spool. And the knitting machine comes with a contraption that will convert a ball of yarn into a spool. But it was broken and it was missing parts. So my coworkers and I engineered a fix for it using coffee cups. And this is my coworker, Dave. Uh... LAUGHTER Using the thing we had MacGyver together from a coffee cup to spool some yarn. So after we set up the machine and successfully knit a single solid row of color, the next step was to learn how to use the machine to knit its built-in patterns. And since I mentioned before, you can thread up to two different colors into the machine. You can use this to knit patterns. And it has a couple of these patterns built into its memory. And it will just thread a different color of yarn for a different stitch if the pattern calls for that. So even though this was something already built into the machine, it felt like the next level up in machine knitting because it required pressing a bunch more buttons and reading like 20 more pages in the manual. And just to illustrate how non-trivial the step was, on the left is our first attempt to knit one of the built-in patterns, a polka dot pattern. And by the end of the day, we finally figured out how to successfully knit a pattern of polka dots on the right. And I wish I had a picture of how happy we were when we actually got this to work. Another example of using engineering and science to solve problems with knitting patterns. While knitting patterns, the machine would get stuck more often than when we were just knitting rows of solid color. So we experimented with different kinds of yarn to use. And after trying each type of yarn, we wrote down notes and we would adjust our hypotheses. So we eventually settled on using... Oops, how did that happen? Only animal wools. They made the machine stuck less, and we think that it was because of the natural oils that were in the fibers. And also for using a thicker yarn for the background color and a thinner yarn for the detail color. But after we had figured out how to successfully knit the built-in patterns on the machine, we hadn't achieved our dream yet. As far as we could tell, the intended audience for this knitting machine was 1980s grandmothers because all the patterns were things like bows and teddy bears. And I don't know about you, but I would rather have grumpy cat on a sweater than a teddy bear. So we still had some more work to do. So step three of our plan was to send the knitting machine our own patterns, and this goal would be split into several parts. So because it was a knitting machine from the 80s, it was able to take additional patterns via floppy drive. Back then, you could buy a floppy drive add-on and additional pattern packs on floppy disks. So we could send our own images to the knitting machine by putting them on a fake emulated floppy drive, and we would emulate the floppy drive on one of our laptops. And then we needed to build a custom cable, the cable that would have gone from the floppy drive to the knitting machine, but would instead now be USB from our laptop to the knitting machine serial port. And we had to make this custom because it turned out that the knitting machine has a weird pinout, and thankfully we found documentation on the knitting machine's weird pinout. And we also found a library that emulated a floppy drive, and so that took care of the step. And then next, we wanted to convert the images to the proper knitting machine pattern, which was a one-bit bitmap. And we also found a library that converted images, JPEGs, PNGs, or GIFs to one-bit bitmaps. So now we could have the knitting machine read from our computer as if it were a floppy drive. And here's one of our first custom patterns. Note the dithering on the Shiba Inu. For a bunch of the one-bit bitmap algorithms, they had a bunch of different dithering algorithms, but this was the one that we found looked best. If it's hard to read, it says, wow, oh my God, such fair isle, which is a type of knitting stitch. And here's Grumpy Cat. So we spent one day just having so much fun uploading lots and lots of photos and images, but we didn't want this to be limited to just us who had hacked on it and studied the manual and knew the input sequences for the scripts that we had written. We wanted anyone to be able to print memes from yarn. We wanted to share out the fun. So step four was to make knitting machine image upload available on the web. And it was a super simple interface. You choose a photo to upload. You'd send the image to the knitting machine and serve up the fake floppy drive. And then the web browser would show you instructions for the buttons to press on the knitting machine to start knitting your pattern. And here is a video of the whole thing in action. You didn't see it in the video. Here is a close-up of the knitted image and the original input. And I brought a bunch of other knitting samples with me. So if you find me after the class, you can see Grumpy Cat in person. There's also one of some bunnies. So now it's code time. So here's the code for the knitting server. We included a wrapper for the library we used to convert images to one-bit bitmats and also a wrapper for the disk drive emulator. So first, you save the user's uploaded photo to a file and then you use the library to convert that image to one-bit bitmap and then you start emulating your floppy disk drive with that image on it. And then the server shows knitting instruction machines for which buttons you should be pressing. And here is the code for the upload form. So things that we learned from this adventure. First of all, we gain mad respect for grandmothers and anyone else who knits because that shit is hard. I recall so many moments where my teammates said things like, I thought that my job was hard, but optimizing database queries ain't got nothing on this. Another learning is something that I mentioned earlier that teams work so well when everyone operates with zero ego at stake. Also that it's really enjoyable to apply Ruby or programming to any of your hobbies no matter how unrelated they seem, especially hobbies related to art and creating. And I challenge you to find a hobby that is more unrelated to Ruby than knitting, but even with knitting it was possible. And the last is that it feels really great to take up something new that you don't know anything about. So many of my teammates said that this was the most fun and challenging thing they had worked on all year. Learning something brand new and very different from what you do day to day is really humbling and challenging and it reminds you what it's like to be a beginner. And that kind of empathy is really important as you work with new programmers while you work with them or might teach them or mentor them. And there's still a lot left to do in this whole space. And the amazing thing about having been given this talk at a few different places is that at every conference people have come to talk to me afterwards for ideas about how I could take this further. So on the knitting access, right now everything that I showed you was just a swatch of knitting, but it would be amazing to learn how to use the machine better to knit whole garments like socks and sweaters and socks with toes. And actually, when I gave this talk at Madison Ruby, Liz Amante was telling me about a machine knitting academy in Seattle where they teach you how to make actual sweaters. So I signed up for a class in January. And the next time I am giving this talk, hopefully I will be wearing a grumpy cat sweater. And on the web interface axis it would be amazing to have an interface where you could draw an image and send that to the knitting machine without having to use an already existing image and maybe also previews for what your design would look like with different colors. On the hardware hacking access it would be amazing to figure out how to automate more of the process. You saw that a person had to manually move the carriage back and forth. And some people have also come and talked to me after some of my talks about ideas to make that happen and I would love to get into those. And I would love to hear from any of you if you have ideas about hardware hacking or knitting or combining art with code. You can reach me on Twitter at SailorHG. And thank you so much for listening and thank you so much for having me.