0%

对于之前的MIT课的一些要点概括

Vim

  • Ctrl + d 向下滚动半屏 Ctrl + u 向上滚动半屏
  • w (next word), b (beginning of word), e (end of word)
  • gg 移动到文件头 G(shift + g) 移动到文件尾
  • 0移动到本行第一个字符上 $ 移动到行尾
  • 查找/{regex}, n / N 下一个匹配
  • u 撤销(Undo) Ctrl + r 重做(Redo)
  • 删除d{motion}
  • e.g. dw is delete word, d$ is delete to end of line, d0 is delete to beginning of line
  • 修改c{motion}
    • e.g. cw is change word
阅读全文 »

Keyboard remapping

As a programmer, your keyboard is your main input method. As with pretty much anything in your computer, it is configurable (and worth configuring).

The most basic change is to remap keys. This usually involves some software that is listening and, whenever a certain key is pressed, it intercepts that event and replaces it with another event corresponding to a different key. Some examples:

  • Remap Caps Lock to Ctrl or Escape. We (the instructors) highly encourage this setting since Caps Lock has a very convenient location but is rarely used.
  • Remapping PrtSc to Play/Pause music. Most OSes have a play/pause key.
  • Swapping Ctrl and the Meta (Windows or Command) key.
阅读全文 »

What do we mean by “metaprogramming”? Well, it was the best collective term we could come up with for the set of things that are more about process than they are about writing code or working more efficiently. In this lecture, we will look at systems for building and testing your code, and for managing dependencies. These may seem like they are of limited importance in your day-to-day as a student, but the moment you interact with a larger code base through an internship or once you enter the “real world”, you will see this everywhere. We should note that “metaprogramming” can also mean “programs that operate on programs”, whereas that is not quite the definition we are using for the purposes of this lecture.

阅读全文 »

In this lecture we will go through several ways in which you can improve your workflow when using the shell. We have been working with the shell for a while now, but we have mainly focused on executing different commands. We will now see how to run several processes at the same time while keeping track of them, how to stop or pause a specific process and how to make a process run in the background.

We will also learn about different ways to improve your shell and other tools, by defining aliases and configuring them using dotfiles. Both of these can help you save time, e.g. by using the same configurations in all your machines without having to type long commands. We will look at how to work with remote machines using SSH.

阅读全文 »

Have you ever wanted to take data in one format and turn it into a different format? Of course you have! That, in very general terms, is what this lecture is all about. Specifically, massaging data, whether in text or binary format, until you end up with exactly what you wanted.

We’ve already seen some basic data wrangling in past lectures. Pretty much any time you use the | operator, you are performing some kind of data wrangling. Consider a command like journalctl | grep -i intel. It finds all system log entries that mention Intel (case insensitive). You may not think of it as wrangling data, but it is going from one format (your entire system log) to a format that is more useful to you (just the intel log entries). Most data wrangling is about knowing what tools you have at your disposal, and how to combine them.

阅读全文 »

Writing English words and writing code are very different activities. When programming, you spend more time switching files, reading, navigating, and editing code compared to writing a long stream. It makes sense that there are different types of programs for writing English words versus code (e.g. Microsoft Word versus Visual Studio Code).

As programmers, we spend most of our time editing code, so it’s worth investing time mastering an editor that fits your needs. Here’s how you learn a new editor:

  • Start with a tutorial (i.e. this lecture, plus resources that we point out)
  • Stick with using the editor for all your text editing needs (even if it slows you down initially)
  • Look things up as you go: if it seems like there should be a better way to do something, there probably is.
阅读全文 »

《好莱坞往事》(Once Upon A Time In Hollywood)

获得了今年奥斯卡的最佳男配(布拉德皮特)和最佳美术。也算是我看的第一部昆汀的电影,惭愧。

应该来说还是夹杂着昆汀许多的私货和情感在里面的。在不知道当时的时代背景和曼森家族的背景下,乍一看肯定是一个好莱坞的群像。从小李子饰演的过气演员,皮特饰演的过于帅气的替身,以及玛格特·罗比饰演的波兰斯基的老婆,三者其实代表了在60年代的好莱坞,从上到下的三个阶级。以及玛格丽特·库利(awsl,我第一眼看到这个演员就觉得眼熟,原来是在死亡搁浅里饰演了玛玛)扮演的曼森家族的嬉皮士女孩,更使得整个好莱坞的生态变得更加丰富。

阅读全文 »

What is the shell?

Computers these days have a variety of interfaces for giving them commands; fancyful graphical user interfaces, voice interfaces, and even AR/VR are everywhere. These are great for 80% of use-cases, but they are often fundamentally restricted in what they allow you to do — you cannot press a button that isn’t there or give a voice command that hasn’t been programmed. To take full advantage of the tools your computer provides, we have to go old-school and drop down to a textual interface: The Shell.

阅读全文 »

我们需要恢复到一种不将自己视为局外人的「公共生活」观念中,不再冷漠或犬儒地对政治问题冷眼旁观,不蜷缩在感人肺腑、含情脉脉的「世外桃源」生活之中。

只有清算那些让他们身陷窘境、导致他们付出许多不必要牺牲的主政官员,才真正对得起这些最可敬的医疗工作者、也才能让他们安心战斗。

纪念李文亮医生和所有其他逝去的生命。

阅读全文 »