Cheatsheet

Equivalent Linux Commands In MacOS

Even though I’ve been using MacOS for a while, there are certain things that I just still remember doing in Linux. Probably it got burned into my mind when I was under pressure to debug something in work. Whatever the reason, I can never remember how to do similar in MacOS. So I’m noting them down here. Listing Open TCP Ports Equivalent to netstat -nap: lsof -nP -i4TCP:$PORT | grep LISTEN Managing Daemons The tool to manage running services and daemons is launchctl.

Continue reading →

Working With CSVTK

There’s a small tool called csvtk which can be used to do various things with CSV files on the terminal. It’s… fine. If I had my own way, I would’ve made different decisions. But one thing going for it is that it exists, and my fantasy tool does not, so it’ll do for now. Anyway, here’s a collection of common operations that this tool supports. Grep The grep subcommand requires both the field, using -f , and the pattern, using -p:

Continue reading →

Go: Random Language Notes

Some random notes about the Go language. Commas in Expression Case Statements The use of comma in case statements work for expression: x := 2 switch { case x == 1, x == 2: fmt.Println("x < 3") default: fmt.Println("x >= 3") } If x is 1 or 2, the x < 3 will be printed out. Lookups On A Nil Map You can do lookups on a nil map: var xs map[string]string = nil x, hasX := xs["hello"] The result will simply be the zero value of the particular type.

Continue reading →

Git: Submodules

Git cheatsheet for working with submodules.

Continue reading →

Git: Diff And History

Git cheatsheet for working with diffs and history.

Continue reading →

Git: Committing

Git cheatsheet for working with commits

Continue reading →

Quickly Starting A Dev Server

Here are various ways to start a HTTP dev server on the terminal. Python 2 $ python -m SimpleHTTPServer Python 3 $ python -m http.server

Continue reading →