Learning-Directed Hacking

Maximizing the motivation to learn

Lindo St. Angel
7 min readFeb 12, 2020
Photo by Cristofer Jeschke on Unsplash

From technopedia:

Hacking generally refers to unauthorized intrusion into a computer or a network. The person engaged in hacking activities is known as a hacker. This hacker may alter system or security features to accomplish a goal that differs from the original purpose of the system.

Hacking can also refer to non-malicious activities, usually involving unusual or improvised alterations to equipment or processes.”

As I am sure is the case with many readers, it is challenging for me to find time to learn new skills with family and work commitments. I firmly believe in the importance of disciplined time management in all aspects of life including enabling continuous learning. To this end, I wanted to write about a tool I use, which I call learning-directed hacking. Hacking in this context is the “good” kind (as described above) and since it relies on existing systems or components, tremendous leverage can be had both in terms of learning and solving practical problems.

What is Learning-Directed Hacking?

Simply described, learning-directed hacking is a way to quickly learn a new skill by solving a real problem by altering hardware, software or processes. Combined with disciplined time management, it can be very effective to stay current and add value to existing solutions. In addition, it maximizes training by aligning beneficial problem-solving and learning desirable new skills. The approach is generally described by the six steps below.

Step 1: Find a problem that you really want to solve that will improve your life in some meaningful way

Determining the problem for which existing solutions do not make your life better is an important starting point, one that you will be very motivated to solve. You might find yourself asking “why can’t this thing just do X instead of Y?” or “this is a great product but I hate paying these damned monthly fees” or “there just isn’t anything I can buy to get this job done without costing $2,000” and so on. These are likely good problem candidates. On the other hand, science fiction problems probably won’t work in this framework. Achieving cold fusion would be amazingly useful but I’m pretty sure you can’t hack your way to that.

Step 2: Determine what skill(s) you want to learn or improve

The desire or need to learn a new skill can stem from a variety of reasons but the skill has to be materially useful or interesting to you, personally or professionally. If not, then you’ll probably be less willing to put in the time to learn it and solve the problem. The skill also needs to be relevant and necessary to solving the problem you set out to solve in the first place. The usefulness of solving the problem and learning the skill are thus intertwined. For example, hate paying the monthly fees for that new IP camera but still want to save recordings? Well that’s a very good problem to solve. Been wanting to learn about AWS S3, DynamoDB, etc.? Learning how to use those services in pursuit of a problem worth solving provides the motivation to do both.

Step 3: Set requirements and goals for your project

Like any goal worth achieving, establishing requirements and goals against which to measure your progress is essential.

STEP 4: Build on an existing solution that is: (i) related to the problem you want to solve, (ii) favors integration over deep invention and (iii) offers the opportunity to learn the new skill

Points (i) and (ii) are the essence of a good hack since you don’t have to reinvent everything and it allows you to focus on solving problems of a quite complex nature, potentially made up of many different components. But the component or process you are hacking needs to be suitable for learning the new skill so it’s critical that you factor point (iii) into your hack. Want to learn about cross-linking polymers (the new skill) and are tired of paying too much for gummy worms (the problem)? Perfect opportunity to hack sodium alginate and make gummy worms on the cheap anytime you want!

STEP 5: Structure and document your project in a way that makes it easy for others to copy or hack

Doing this amplifies your learning in several ways. Documenting your project in a clear, concise way clarifies your thinking and more deeply ingrains the learning and opens the possibility of others riffing off your hack and learning from that.

STEP 6: Iterate until your requirements and goals are met

Start hacking and don’t stop until you’ve met the goals of the project you set at the beginning. Pace your work based on your time constraints but realistically to keep learning at a steady pace you’ll need to dedicate a few hours a week, preferably in a contiguous block. For me that’s usually early Sunday mornings.

Hack !== Kludge

According to Wikipedia, a kluge is a “workaround or quick-and-dirty solution that is clumsy, inelegant, inefficient, difficult to extend and hard to maintain”. Creating a kludge will limit the usefulness of your new skill. Try to make your solution maintainable, scalable, portable and compliant to the relevant standards.

What About Just Taking a Course?

Sure, that might help you get up to speed faster but (i) it can be very boring and hence the likelihood of completing the course low and (ii) unless you put that coursework to work solving a real problem, it likely won’t stick with you.

What Resources Can Help?

Here are some of the resources you may find useful for inspiration and reference:

Case Study

Many people like myself have IP cameras without a cloud service that perhaps they’d like to control using Amazon’s Alexa Smart Home Skill API. This API is great but assumes you are using a cloud service for your cameras from the manufacturer and has very specific security and streaming requirements that makes it challenging to connect standalone cameras. In my case I have several IP cameras around the house connected via a LAN to a local Linux machine and are configured to do motion detection and store recordings on the Linux box. I also use Zoneminder as a Network Video Recorder and its mobile companion app zmNinja. No camera cloud service is needed in my system which totally avoids associated recurring costs BUT the system is not Alexa compatible “out of the box”.

To address this need, I created a project called alexa-ip-cam which enables standalone IP cameras to stream live video and recorded video to an Alexa device without needing any camera cloud service.

In this example, software components on a local Linux machine and the Alexa Smart Home API are hacked and I wanted to increase my skill using the Alexa Smart Home API, Node.js, AWS and network protocols such as RTSP. I also set a requirement that the solution must have very low implementation and operating costs (avoiding recurring cloud costs from a camera manufacturer is key to this).

Realizing the benefits coupled with learning these new skills yielded a system consisting of the following main components.

  1. An Alexa Smart Home skill.
  2. An AWS Lambda instance for handling the skill intents including camera discovery and control.
  3. An Alexa-enabled device with a display such as Amazon Echo Show or Fire TV.
  4. A RTSP proxy running on the local Linux machine that aggregates the streams from the cameras on the LAN into one front-end stream. This component isn’t needed if you only have one camera. I used The LIVE555 Proxy Server.
  5. A TLS encryption proxy on the local Linux machine that encypts the stream from the RTSP proxy server and streams it on local machine’s port 443. I used stunnel.
  6. A program running on the local Linux machine that uploads camera recording metadata to the Alexa Event Gateway via the Alexa.MediaMetadata Interface to enable the viewing of past events captured by the camera. In my case I used a Node.js app I created called process-events.js.
  7. A webserver running on the local Linux machine that allows the Lambda instance to access the recordings stored by the cameras. I’m using Apache.

Conclusion

Learning-directed hacking can be an effective tool to solve a problem that’s relevant to you and to learn a new skill. Your hack should not turn into a kludge to make your newly learned skill transferable to the real-world. These are the main six steps to implement a learning-directed hack:

  1. Find a problem that you really want to solve that will improve your life in some meaningful way.
  2. Determine what skill(s) you want to learn or improve.
  3. Set requirements and goals for your project.
  4. Build on an existing solution that is: (i) related to the problem you want to solve, (ii) offers the opportunity to learn the new skill and (iii) favors integration over deep invention.
  5. Structure and document your project in a way that makes it easy for others to copy or hack.
  6. Iterate until your requirements and goals are met.

The alexa-ip-cam project demonstrates this method and the power of commonly available IP cameras, SW components, Alexa and AWS.

--

--

Lindo St. Angel

High technology professional at Amazon creating amazing products and services customers love.