JRehkemper.de

JRehkemper.de

- Homepage and Wiki of Jannik Rehkemper -

New Posts

Stages in Dockerfiles

If you want to compile your Program while building your Container but don’t want you source code to be part of your image, you need to use stages. Why should I want that? My biggest concern is, that your container image gets small if it does only contain the binary and not all of the source code and temporary file from building it. That helps with download and creation-speed. On the other hand one might fear that his source code gets extracted if someone gets access to the image.

Use Air for Live-Reload in Go-Projects

Air is a tool comparable to nodemon for nodejs. It reloads your development server everytime you change you code. This can be quite handy. Installation You can simply install it as a go package. go install github.com/cosmtrek/air@latest After that it is placed in you GoPath. If you don’t know where this is, print the Variable to the Terminal. echo $GOPATH For faster access you can create an alias. alias air='~/go/bin/air' and to make it permanent use your .

Check SSL-Certificates with OpenSSL

Check Certificate File If you have a certificate file (.crt or .pem) and want to read its information you can do it like so. openssl x509 -in mycert.crt -text -noout Checking CSR File The same thing works for Certificate Signing Requests (CSR) openssl req -in myreq.csr -text -noout Check Server-Certificate If you Certificate is already in use on a server, you can connect to it, to read the certificate-information. openssl s_client -connect <server>:<port> | openssl x509 -noout -text

Frontmatter Aliases - failed to unmarshal YAML: yaml: line 5: found character that cannot start any token

If you try to build your hugo site and get this error message failed to unmarshal YAML: yaml: line 5: found character that cannot start any token try replacing tabs with two spaces manually.

Go Snippets

Define Variables mynumber := 1 mystring := "string" var emptyint int var emptystringarr []string var sum int = 2 Conversions Convert to String mystring := string(var) Convert to Integer number, err := strconv.Atoi(mystring) Loops For Each Loop for index, element := range myarr { } Loop Over Database Rows for routes.Next() { var link string routes.Scan(&link) CheckRoute(link) } Read File In one String func readFileAsString(filename) string { dat, err := os.