_   _          _  ____      
    | | | |        (_)/ ___|     
    | |_| |__   ___ _/ /___  ___ 
    | __| '_ \ / _ \ | ___ \/ __|
    | |_| | | |  __/ | \_/ |\__ \
     \__|_| |_|\___| |_____/|___/
                  _/ |           
                 |__/            

             ┌─────────┐
             │ hire me │
             └─────────┘


Things I learned: 2018#19

  • When using a rewrite rule inside of a location block in nginx you might want to add the break keyword to it: Not using it will start a full evaluation of the URL after it is rewritten. break works the way you would expect: It rewrites the rule and continues inside of the block.
  • radicale is a very simple self-hosted cal-dav and card-dav server that can be used to host your own calendars and contacts instead of pushing that data to google: https://radicale.org/
  • Go formatting methods (e.g. fmt.Printf or log.Printf) accept regular printf formatted strings. However the syntax is extended to include precission arguments. With this a string can be pad to a certain length when logging using fmt.Printf("%20s", str) (right-justified) and fmt.Printf("%-20s", strg) (left-justified).
  • For logging purposes the formatting placeholder %v can be used to always output the value of the given argument (no matter the type) in a human-readable form.
  • In go channels can be used to build worker pools. This is useful to control the concurrency of goroutines (e.g. if a single goroutine uses to many resources it can be restricted to only 4 or 8 workers: https://gobyexample.com/worker-pools
  • gorun is a utility to run go files directly using a shebang. However a gorun file is not a valid go file.