Let satoru be X

  • Using Mermaid in Hugo

    Create a shortcode for Mermaid Create a layouts/shortcodes directory in your theme directory. Inside layouts/shortcodes, create a file named mermaid.html. The filename is the same as the shortcode name we are going to use.

    Read more…
  • Don't Treat append Like a Pure Function

    In Go, we add elements to a slice by calling the built-in append function, one typical use case is: names = append(names, "satoru") Unlike programming languages like Python or Java in which we call some append method on a list and update it in place, in Go, we have to assign the returned value of append back to the variable itself.

    Read more…
  • How to manually download a nltk corpus?

    Go to http://www.nltk.org/nltk_data/ and download whichever data file you want Now in a Python shell check the value of nltk.data.path Choose one of the path that exists on your machine, and unzip the data files into the corpora subdirectory inside.

    Read more…
  • Preallocate, not only pointers but also structs

    If the size of a slice can be decided when it’s created, we can specify its initial size to improve performance, because unnecessary copy operations and memory allocations are avoided. Many Go programmers already know this, but when it comes to a slice of pointers, things are a little more interesting.

    Read more…