Learning Progress TIL: About Container Orchestration

Read more →

TIL: Replace Local Files With Remote Files With Git

Read more →

TIL: Typescript Still Coerces Types

Here's a simple TypeScript function: function f() { const a = 2 const b = 'a string' return a + b } What I expected: TypeScript can infer types. It will recognize that a is of type number and b is of type string. I expected a type error, because I try to add a string to a number. You can also be more explicit and tell TypeScript the types. Like so:
Read more →

TIL: Bind Mounts

Read more →

TIL: ASGI for Python

Today I learned about the ASGI specification for Python frameworks: ASGI (Asynchronous Server Gateway Interface) is a spiritual successor to WSGI, intended to provide a standard interface between async-capable Python web servers, frameworks, and applications. Python didn't have asynchronous execution until recently. Since Python 3.4 there's asyncio in the standard library. asyncio is singl-threaded, single-process - like JavaScript's event loop. ASGI is build on top of asyncio. So, basically, Python now has web servers and frameworks with async capacities.
Read more →

TIL: How to Use Both Gitlab and Github

There are several ways to mirror a repository both on GitLab and GitHub. Repository Mirroring The free GitLab plan allows you to pull from a remote repository. You could use a GitHub repository as the main repo, and the GitLab repo as the mirror. In theory, you can also push from GitLab to GitHub. But I couldn't get it working on GitLab's free plan. Remote Repositories and Overloading The alternative is to “overload” your remote repository address.
Read more →

Suspend Vim to the Background or What Is Linux Job Control

Vim has an inbuilt terminal, which you can start with :terminal. That means that you don't have to leave your Vim editor to run commands in the shell. Sometimes, it's still useful. If you quickly want to switch to your shell, suspend the Vim editor with Ctrl+z. That sends the process into the background (on Linux). Now you have access to your standard terminal and can run commands. Type jobs or jobs -l to see a list of the background processes.
Read more →

Vim Undo And Redo

Today I learned about Vim undo and redo. Undo changes: in normal mode: u to undo latest change, U to undo all changes in Ex mode (command mode): :u to undo latest change Use :u {N} to undo a number of changes. For example, :undo 5 reverts the latest 5 changes. Redo changes: in normal mode: Ctrl+r in Ex mode: :re or :redo In Vim, undo is a tree:
Read more →

Start Vim With Terminal Command

Today I learned that you can start Vim with a terminal command. Vim has the -c flag, which you can use for running an Ex command. The same is true for NeoVim, which also has an inbuilt terminal. So you can either start NeoVim inside the terminal like so: nvim +te or like that: nvim -c ':terminal' The second option allows you to run another command afterwards. Example: nvim -c ':terminal hugo server -D' Now NeoVim starts in terminal mode and runs my Hugo development server immediately.
Read more →

Run Macro On Multiple Lines in Vim

Modern editors like VS Code or Sublime Text can use multiple cursors to edit code on more than one line. Vim doesn't offer this functionality out of the box. But you may not need it. Today I learned how to run a macro to edit several lines in Vim. The method is useful when you have a similar structure on several lines, for example: <li class="link">About</li> <li class="link">Blog</li> <li class="link">Works</li> Add the script visual-at.
Read more →