DEV Community

wimdenherder
wimdenherder

Posted on • Updated on

 

A supervaluable trick of learning: improving your memory and flow

Improving yourself is one of the nicest feelings in the world. And as a programmer also one of the most important skills today probably. Lately I found out a way that works really well for me, let's see if it works for you.

When I'm in the flow of learning, things come naturally to me and I'm motivated to learn more about things. I start with a very inspiring goal, for example to create a YouTube interface that dubs voices automatically in any language (by the way I succeeded doing so, see the result on YouTube). With this superbig goal in mind I start to break it up in small subgoals.

  • How do I get the subtitles from a video?
  • How do I translate it?
  • How do I make a spoken voice from text?

Now I can dive into something that interests me and it gets me into the state of flow. The real problem is when you actually want to program, but you don't know where to start. This problem will be solved with this supernice trick:

Record everything you do on your computer

I'm doing this with Quicktime. I tried also programs that compress it, but that makes the computer really slow. Then of course I recommend to buy an extra 2+ Terabyte hard disk and save everyday's screen capture to it (and protect it with a password). It will give you the ability to look back in history what you did, how you solved problems, what you learned and what you skipped. By looking back you'll get very quickly back in the flow state. I think for most people memory is the weakest link. Our memory is not as good as we think it is. So by recording your screen you make yourself smarter. :)

Image description

The second advantage comes from the fact that programming is actually quite a reactive activity. You respond to a problem, to a goal you have. You suddenly experience that loading video's takes too much time and that TikTok solved this problem. At that moment you feel motivation to create a video loader too! (see the result here at github). That's why I like to do a tactic that Leonardo Da Vinci was famous for: immediately dive into this subject and immerge yourself. Da Vinci very often did not even finish the projects of people who paid for it. Can you imagine? As a programmer starting out for a company and then taking so many sideroads that you don't deliver? It would make you end up in history books eventually ;) The reactive nature of programming is quite surprising for me. But ask yourself: how often do you proactively decide: I'm going to do this or that before you switch on the laptop? For me it's almost always that I'm already on the computer encountering something interesting that gets me into the programming. With the screen recording strategy you can trigger yourself by watching yourself from the past. You see yourself browsing, coding, reading, studying. You really need that trigger, that moment that you're in flow.

The third very clear advantage is that you don't want to waste time while recording. You kind of keep yourself accountable for what you do. You want to plan in blocks in which you learn tutorials. Another advantage here is that what you learn can be watched back, so it feels more stable as knowledge. Still I make notes by the way. I keep them in categorized lists. And also these lists should come back in the future as a reinforcement for learning and a trigger for more learning.

The fourth advantage is that it's easier to take breaks, because you can continue where you stopped. This is good for your health. Taking a small break is also good for creative insights. Einstein did many walks during the day as the rumours go.

If you just want screenshots (jpg every interval), you can run this command below in your terminal on Mac, where /Volumes/harddiskname/ refers to your external hard disk. You should change it to the name of your external hard disk. Trick: you can find this path by dragging a file from the external hard disk to the terminal.

EXTERNAL="/Volumes/harddiskname/";
DATE=`date "+%Y-%m-%d_%Hh%Mm"`;
mkdir $EXTERNAL$DATE;
while [ 1 ];
do screencapture -t jpg -x $EXTERNAL$DATE/$i-screencapture.jpg; 
sleep 6; 
done
Enter fullscreen mode Exit fullscreen mode

Or copy this oneliner:

EXTERNAL="/Volumes/harddiskname/";
DATE=`date "+%Y-%m-%d_%Hh%Mm"`;mkdir $EXTERNAL$DATE;while [ 1 ];do screencapture -t jpg -x $EXTERNAL$DATE/$i-screencapture.jpg; sleep 6; done
Enter fullscreen mode Exit fullscreen mode

If you also want to convert it, you can download ImageMagick on mac with brew:

brew install -g imagemagick
Enter fullscreen mode Exit fullscreen mode

And then run this. The command convert runs imagemagick. The next script creates a very low quality 10% jpg every 30 seconds. It costs only 30 GB per year full workweek 40h per week to store everything:

EXTERNAL="/Volumes/screencaptures/";
DATE=`date "+%Y-%m-%d"`;
mkdir -p $EXTERNAL$DATE;
while [ 1 ];
TIME=`date "+%Hh%Mm%Ss"`;
do screencapture -t jpg -x $EXTERNAL$DATE/$TIME.jpg; 
convert $EXTERNAL$DATE/$TIME.jpg -quality 10 $EXTERNAL$DATE/$TIME.jpg; 
echo "creating screenshot $EXTERNAL$DATE/$TIME.jpg"; 
sleep 30; 
done
Enter fullscreen mode Exit fullscreen mode

Or one-liner:

EXTERNAL="/Volumes/screencaptures/";DATE=`date "+%Y-%m-%d"`;mkdir -p $EXTERNAL$DATE;while [ 1 ];TIME=`date "+%Hh%Mm%Ss"`;do screencapture -t jpg -x $EXTERNAL$DATE/$TIME.jpg; convert $EXTERNAL$DATE/$TIME.jpg -quality 10 $EXTERNAL$DATE/$TIME.jpg; echo "creating screenshot $EXTERNAL$DATE/$TIME.jpg"; sleep 30; done
Enter fullscreen mode Exit fullscreen mode

You can create a video from the screenshots with the following script, that uses ffmpeg (Download here). Head over to the folder with the screenshots and enter:

ffmpeg -framerate 1 -pattern_type glob -i '*.jpg' capvid.mp4
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.