Archive of

Deploy .NET 6 Web Application With GitHub Actions To Self-Hosted Linux Machine (Virtual Private Server, Raspberry Pi, etc.)

This great article taught me how to use github actions to deploy my side project to my cheap VPS. Many thanks to the author!

How to use vim macro to speed up your complex find/replace operations in vim / ideavim

Yesterday, I need to replace a string ClassName with List<ClassName> many times in a few files, and the ClassName varies. Manually doing it again and again is tedious and mistake prone, which is what I hate. Here's the solution

First, record a macro,

  1. move cursor on any letter of the target ClassName
  2. qa
  3. ysiw>
  4. Insert
  5. List
  6. Esc
  7. q

Second, replay the macro, move cursor to another occurrence of ClassName,

@a

Third, replay the same macro as many times as you want: move cursor to any other occurrences, simply type

@@

The feeling is so good to let a computer do what you want it to do!

and here's the Reference where I learnt how to use vim macro. TL;DR;

Delete to beginning of current word in Bash

Instead of pressing backspace repeatedly, press ESC then Backspace.

Reference

Don't you want more? here's some

  • how to delete to the end of the line? Ctrl + k
  • how to delete to the beginning of the line? Ctrl + u
  • Simply move the cursor to the line of the beginning? Ctrl + a

Want a full list?

Here you are

Multiline matches with ripgrep (rg)

You can simply click the title of this blog to check the reference.

The key is the dotall modifier (?s). It helped out me today! by the way, my final match expression is

rg --pcre2 -U '(?s)\.Initialise\([^,]+,\s*([^,]+),\s*\1(?:,true|false)?\);'

rg is a so fast and so powerful tool in my daily use, I love it!

Reference

clean up docker networks/interfaces

docker network ls
then 
docker network rm networkname