Earlier this week I began reading my programming-related notes. I thought some of them were good. Overall, I am disappointed I don’t have more notes organized here. I have various other notes in google docs and handwritten in my journals. I will enjoy consolidating all these notes here, and I look forward to making new ones.

Here is an ordered list of existing programming notes:

I was about to link to these files, when I realized why I never liked Jekyll. IMO, its linking is awful. You must use a liquid helper to make links work.

Gliki left links alone, so you can use relative links that work as expected in your editor and when reading on github. I looked into Hugo, but it’s more of the same. I am somewhat annoyed that I converted this repo without giving it another go.

How does Gliki work?

After cloning repo, CI/CD job calls package.json’s build, which in turn call’s Gulp’s build. Gulp’s build calls the media, gliki, and less tasks. media task copies media file over to build folder. less task compiles less files in .gliki gliki creates a list of markdown files directly from git, along with metadata for each one. it compiles Handelbar templates, and renders each markdown file into HTML file using appropriate template and injected metadata. a custom markdown renderer for links converts links to markdown to appropriate html links automatically.

I’m sure there is some important reason other than the environments and dependencies being old that convinced me against reusing. The dependency on Gulp did not help either. This is usually where someone in management will ask why we broke such a thing. The truth is, none of these reason are great reasons, especially if there was no attempt to use the legacy software.

Gliki’s expectation is that the content is in a git repo. It uses this repo to read metadata regarding the file itself: when it was created, last edited, etc.

This is frustrating.

This is the simplest golang example: https://gobyexample.com/hello-world

# write hello world golang file
cat << EOF >> main.go
package main
import "fmt"
func main() {
    fmt.Println("hello world")

# run file
go run hello-world.go

Right away VS Code asked me to install staticcheck and gopls.

I can now use exec to run this noise:

git ls-files *.md \
    | while read filename; do
        modified_by=$(git log -1 --format="%ad,%an,%ae,%H" --date=short -- $filename)
        created_by=$(git log --diff-filter=A --format="%ad,%an,%ae,%H" --date=short -- $filename)
        echo "$modified_by,$created_by,$filename"
        done \
    | sort -r

Or maybe it’s better to use a proper library?

// https://pkg.go.dev/github.com/go-git/go-git
import "github.com/go-git/go-git/v5"

If working with git, you should understand this: https://shafiul.github.io/gitbook/1_the_git_object_model.html

What version of go is this? go version

If I want to use modules, I have to initialize it first:

go mod init goliki
go get github.com/go-git/go-git/v5
go get github.com/yuin/goldmark