I’m a dev guy. A programmer. A software engineer without a degree. But above all else, like every other programmer I know, I’m a problem solver.
I like to think that most people hate mundane, monotonous tasks. You have a giant spreadsheet, or huge text file, or even a giant pile of shirts that have to be hung.
Open spotify, launch your favorite upbeat radio station. Dump all the clothes out onto the bed. Grab a stack of hangers. Make sure they all face the same way though, that should make this easier. Pickup one shirt, and slide the hanger in, hang that up. Do another, but this time you realize the shirt was just piled in a different direction. Let’s quickly arrange all the shirts the same way. Ok great, all the shirts are flat and their necks are aligned. Let’s do the same to the hangers real quick, make sure they all face the same direction. Ok now we’ve got an assembly line of sorts. Hanger, shirt, hang, next.
The time it takes to take the hanger over to the closet is a bottleneck. If we just put all the hangers in, we can probably do all 30 shirts really fast. (I wear a lot of T shirts). And then we should be able to grab a giant stack of shirts (now all aligned) and hang them up at once.
Hanger, slide, drop, hanger slide, drop.
We did the whole pile in about 3 minutes. Not bad. Add in the time it takes to arrange the shirts, hangers and move a couple stacks of shirts to the closet, and you’ve got about 6 minutes.
What if you could do it even faster?
A quick youtube search for life hacks shows us how we can just slide all the shirts onto our arm, hand through the neck, and then just pop off each shirt onto the bar in the closet. Let’s give this a shot.
It takes about 1 minute from dumping all the shirts to slide them all onto one arm. A bit heavy, but no big deal. If we take all the hangers off the closet the same way to begin with, we avoid that step. Ok great, got the pile of hangers, shirts on my arm, let’s get started.
The video has us hanging after each shirt. But we learned earlier that we can do that in bulk. But because the shirts are all on our arm in the right direction, we can slide a hanger at roughly 1 per second. That’s about 30 seconds to do all 30 shirts. We can hang that in 2 stacks, at about 10 seconds per hang. Add in the dumping of the shirts and sliding onto the arm at about 2 minutes. That gives us a total of 2 minutes 50 seconds. That’s twice as fast as before.
Being a programmer is about problem solving. It comes down to the ability to identify a problem, do research, ask questions and above all else: be lazy.
A friend of mine, also a programmer, told me a situation in which he used programming to his advantage. That inspired me to think of all the ways we actually use programming in our everyday lives.
He needed to sign up for a college class. But the class was currently full. A lot of crappy college online systems have some java or outdated web tool to sign up, so you can't just refresh the page. Even if you could, you wouldn't want to sit there and refresh every 10 seconds hoping a seat would become available.
So using cURL, he wrote a bash script that basically hit the schools server with some GET params that acted just as if he was physically hitting the same page. To accomplish this, he first went to the site and noticed the URL location. It had the page he wanted, but also the class information in the URL. And then upon inspecting the page, he noticed the form being filled out and what values it took.
So using cURL he hit the page, because that had to happen first, waited some arbitrary time, and then submitted the form. He then regex scraped the result which contained the number of open seats. Running this script would result in a number either 0 or greater, meaning if there are seats available for that class.
Turns out you can just change the class number and check the number of seats for any class, but that’s just a happy side effect.
He stopped here, because there is yin and yang between doing too much programming for not enough result. But he could have thrown the script into a cron job that ran every 5 minutes, and sent an SMS when the number was greater than 0.
Or even further and figured out how to actually sign up via cURL and as soon as it becomes available, it would sign him up.
Needless to say, he got into the class.
If you've used programming to hack your life any way, I'd love to hear about it.