Day 10: My One Line for Recency in the Shell

I have a pretty nifty solution for Exercise 5. I don’t know how it ranks in terms of Big O notation but it works and I understand it so that’s all I need as a beginner!

TLDR;

Okay, so here are the highlights of what I did:

  • Finished my solution for exercise 5 from MIT Missing Semester Course.
  • Started some notes on the headtailstatawk, and sort programs in the shell.
  • Saw a clip from The Social Network movie where Jesse Eisenberg (who plays Mark Zuckerberg) was getting all the pictures for the facesmash site by “hacking”.

Exercise 5 Solution

After reading a bunch of stack solutions I found that the easiest solution for me involved using the ls command with a few options ticked off. Additionally for the sake of not viewing a gigantic list I passed the ls results as a argument for the head command.

$ head -n 1 <(ls -ltR $directory)

If this in run in the root directory it will take some time to recursively go through all your files but it will get the job done. Additionally, you can run this in any directory and even add file type specifications. Example:

$ head -n 1 <(ls -ltR $directory | grep "\.$filetype")

* Disclaimer I am still a noob so don’t blame me if any of this crashes your system!

A lot New notes

I saw a lot of code that I did not understand while I was going through the solutions people were offering up. I figure, I should just keep trying to formulate my thought process through my notes so that I have actual check points for when I need to really understand a program or subject. Just like in videos games, save points are everything!

The Social Network Clip

For context, here is the scene. I ignored most of the emotional and moral context associated with the scene, movie, and person. I just skipped parts and focused on the code that was being mentioned in the script and how the process was presented.

I have to say, it was a really cool experience for me. While I was watchign the scene I understood some of what he talked about. Like the wget magic and limiting search results. I am still a long way from replicating that sort of “hacking” (If that’s what that really is…) but it showed that I understand a bit more than when I first watched the movie and saw that scene.

Overall, I’m looking to understand how things work so being able to even increase my ability to understand by 1% is a win for me.

Conclusion

That’s all for today. Btw I am moving on to lecture #3 since I finished all the exercises from lecture #2. if you are interested in the MIT course you can check out the video lecture I’m currently going through. The lecture is helpful but isn’t sufficient by itself. Anyways, until next time PEACE!