Automation

Consider all the little things you do every day. How many of them do you consider as ends and how many as means? What if you could remove all the chores you have? The simple truth is - you would have more opportunities.

We are the beneficiaries of two centuries of progress in automation and as a result - it is difficult to single out all the little details, that we don’t have to take care off. One simple example - tap water, you just open the tap and water rains down. How much effort does that take? Now imagine you’re living in Bangladesh. To accomplish the same thing, you would need to travel for hours to reach the nearest well and then hours to get back. Given the limited nature of time, how many opportunities are taken away when just to sustain yourself, you have to spend multiple hours a day to get water?

We shouldn’t take things for granted, but we also shouldn’t stop moving forward. Automation is one of the most visible manifestations of progress and it is our responsibility to free ourselves from the mundane.

Little things #

Looking from the perspective of programming, it is not difficult to see it’s filled with a lot of mundane tasks. The important part is the idea, the algorithm, the system, but in order to transfer all those ideas from your head onto the computer you have to type it up. The longer it takes for you to do that, the less of an impact you’ll be able to have. The name of the game is - use as few keystrokes as possible.

This requires you to automate all the little things, you know, the semicolons, the curly brackets, indentation, etc.

int main(void) {
    for (;;) {
        int a = 0;
    }
}

The example above contains multiple instances you could automate. C delimits blocks with {}, it is also advisable to increase the indentation inside a block. This requires you to type the following series of commands after you decide to declare a block.

Ctrl+A
i // enter insert mode
Space
{
Enter
Enter
}
Esc
k // move up
i
Tab

How many times would you like to complete this sequence of 11 keystrokes? Me personally - zero. Thankfully with VIM macros you can record the this sequence once, and then infinitely replay it with a simple @b command, where b is the name you gave your macro.

Abstracting #

One common task is to extract data from an unstructured format. This has the potential to take up a lot of your time, unless you automate. But single automations may not be enough, it is when you abstract them into collections do you get access to real power.

Here’s an example.

            <tr>

        <td title="gStudId=171310; fin_kod = 8; nerotuoja_poz = ">23</td>
        <td>1311010</td>

        <td style="text-align:center;">1</td>
        <td style="text-align:center;" align="center" title=""><b>VFk</b><sup style="font-size:6.0pt;">1</sup></td>

        <td style="text-align:center;">

        </td>

            <td><b>         10.00</b></td>

            <td style="text-align:right;">16,48</td>

                <td
                    style="text-align:left;"
                >
                    <b>10</b>;<span style="font-size:0;overflow:hidden;width:0;"> </span><b>10</b>;<span style="font-size:0;overflow:hidden;width:0;"> </span><i class="clsPrintBlack">10</i>;<span style="font-size:0;overflow:hidden;width:0;"> </span><b>10</b>;<span style="font-size:0;overflow:hidden;width:0;"> </span><b>10</b>;<span style="font-size:0;overflow:hidden;width:0;"> </span><b>ásk.</b>;<span style="font-size:0;overflow:hidden;width:0;"> </span>
                </td>

            <td style="text-align:right;">      35.0</td>
            <td style="text-align:right;">      35.0</td>
        </tr>

This looks completely indecipherable to a human (it’s a row of a table in HTML). Now image you needed to extract data of a 100 similar entries from the same table. That would undoubtedly be mundane.

But with this knowledge of automation, VIM macros to be exact, you can start thinking of all the individual sequences required to extract each bit of data. Then, when you have all of those ready, abstract them into a single macro that extracts all those bits from a single row. Now, finally, just command your editor to repeat this a 100 times with 100@a, where a is the name of your abstracted macro.

And lo and behold, in a flash and without any mundane work, you have a collection of structured data ready for interpretation.

23,1311010,1,VFk,10.00,16,48

Leverage #

One way to quantify our power in life is to measure the leverage we have on our time, that is how much more can we do given a limited amount of time than everybody else. With physical strength, people peak at 2-3 times more than average. With automation - there is no limit. Having the possibility to do a 100, a 1000 times more than average is unprecedented. Or should I say - was, until now.

 
4
Kudos
 
4
Kudos

Now read this

Teaching yourself by teaching others, slowly.

At some point during my CS studies I decided to do a lecture on the C programming language. At that point I had no clue whatsoever about the language, but this was in a way an experiment to test if it’s any easier to learn something by... Continue →