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

Running OCIS on a remote host

  1. clone github.com/owncloud.ocis
  2. either make clean build or go run...
    1. if no support for mDNS set MICRO_REGISTRY=etcd and run etcd > etcd &
  3. edit environment to configure konnectd:
OCIS_BASE_URL=your.machine:9200
PROXY_HTTP_ADDR=0.0.0.0:9200
package mapConc
import (
"fmt"
"sync"
)
type db struct {
mutexes sync.Map
values sync.Map
@refs
refs / main.go
Created February 11, 2021 19:28
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
)
@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)
}
}

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 / EBNF-cheatsheet.md
Last active June 3, 2024 13:03
Extended Backus-Naur Form Cheatsheet

Symbols

Usage Notation
definition =
concatenation ,
termination ;
alternation |
optional [ ... ]
repetition { ... }
@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
{
"data": [
{
"traceID": "d2830a66661f988972e7346da6321b1f",
"spans": [
{
"traceID": "d2830a66661f988972e7346da6321b1f",
"spanID": "abf640a6157a8a35",
"flags": 1,
"operationName": "Stat",
@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"
mode: 0
file: ""
ocisurl: ""
registry: ""
log:
level: info
pretty: false
color: false
file: ""
debug: