Skip to content

Instantly share code, notes, and snippets.

View refs's full-sized avatar
🤖
Another pointless day where I accomplish nothing 🍸

Alex Unger refs

🤖
Another pointless day where I accomplish nothing 🍸
View GitHub Profile

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages

Config Demo

  • there are no high level differences
    • we got rid of cli flags for extensions
  • admins can still configure an instance using a single ocis.yaml
  • or overwrite global values present in ocis.yaml with extension.yaml (i.e: proxy.yaml)
  • formats supported are
    • json
    • yaml
    • but decoders are easy to extend
mode: 0
file: ""
ocisurl: ""
registry: ""
log:
level: info
pretty: false
color: false
file: ""
debug:
@refs
refs / ow.sh
Last active August 17, 2021 13:48
#!/bin/sh
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color
ENV=""
BUILD="false"
RESTART="false"
{
"data": [
{
"traceID": "d2830a66661f988972e7346da6321b1f",
"spans": [
{
"traceID": "d2830a66661f988972e7346da6321b1f",
"spanID": "abf640a6157a8a35",
"flags": 1,
"operationName": "Stat",
@refs
refs / pointers.go
Last active May 27, 2021 11:26
Wrapping your mind around Go's double pointer dereference
package main
import "fmt"
type example struct {
a string
b string
}
// run me on https://play.golang.org/p/xxbFzUHBM6j
@refs
refs / EBNF-cheatsheet.md
Last active October 22, 2022 00:25
Extended Backus-Naur Form Cheatsheet

Symbols

Usage Notation
definition =
concatenation ,
termination ;
alternation |
optional [ ... ]
repetition { ... }

How many ways does ocis load config

The precedence for flag value sources is as follows (highest to lowest):

  1. Command line flag value from user
  2. Environment variable (if specified)
  3. Configuration file (if specified)
  4. Default defined on the flag

An issue arises in point 2, in the sense that configuration file refers to a single file containing the value for the env variable.

@refs
refs / mem_bomb.go
Created March 25, 2021 13:39
golang memory bomb
package main
func main() {
a := make([]int, 2, 4)
for i := 0; i < cap(a); i++ {
a = append(a, i)
}
}