Skip to content

Instantly share code, notes, and snippets.

View rogerwelin's full-sized avatar
:shipit:
Gopher

Roger Welin rogerwelin

:shipit:
Gopher
View GitHub Profile
@rogerwelin
rogerwelin / exercises.md
Last active September 15, 2022 19:18
js exercises
  1. Write a function that takes an array of numbers and returns an array of strings
function stringItUp(arr){
  // your code here
}

console.log(stringItUp([2, 5, 100])); // ["2", "5", "100"]
const axios = require('axios');
const getapa = async () => {
try {
let response = await axios.get('https://jsonplaceholder.typicode.com/users');
return response
} catch (error) {
throw new Error(error)
}
}
@rogerwelin
rogerwelin / contextsigint.go
Created May 20, 2021 13:13
context sigint
package main
import (
"context"
"fmt"
"log"
"os"
"os/signal"
"time"
)
@rogerwelin
rogerwelin / rng.go
Last active February 9, 2021 18:28
package main
import (
"fmt"
"math/rand"
"time"
)
func returnRandom(value int) string {
@rogerwelin
rogerwelin / bb-api
Last active February 3, 2021 20:57
repo-groups
https://docs.atlassian.com/bitbucket-server/rest/5.2.1/bitbucket-rest.html#idm45701776441776
https://docs.atlassian.com/bitbucket-server/rest/5.2.1/bitbucket-rest.html#idm45701776450800
/REST/API/1.0/PROJECTS/{PROJECTKEY}/REPOS/{REPOSITORYSLUG}/PERMISSIONS/GROUPS?PERMISSION&NAME
Promote or demote a group's permission level for the specified repository. Available repository permissions are:
* REPO_READ
* REPO_WRITE
* REPO_ADMIN
package logger
import (
"log"
"os"
"github.com/fatih/color"
)
var (
package main
import (
"io/ioutil"
"gopkg.in/yaml.v2"
)
type config struct {
APIVersion string `yaml:"apiVersion"`
@rogerwelin
rogerwelin / go-git.go
Last active January 20, 2021 21:52
use go-git & memfs to push files to remote
package main
import (
"fmt"
billy "github.com/go-git/go-billy/v5"
memfs "github.com/go-git/go-billy/v5/memfs"
git "github.com/go-git/go-git/v5"
config "github.com/go-git/go-git/v5/config"
http "github.com/go-git/go-git/v5/plumbing/transport/http"
package main
import (
"fmt"
"net/http"
"sync"
)
type HttpResult struct {
Url string

Controllers - execute business logic.
Resources - provide storage and resources.
Webhooks - defaulting, validation, conversion.

Resource stores stuff --> Controller does stuff.

Resources (example Foo resource) are stored in ETCD by the apiserver. Async watch notifications on object create / delete / update from Foo Resource in ETCD to Foo Controller.

  • Request comes in to Request API - apiserver stores it in ETCD
  • after object is stored apiserver sends watch events to clients watching that Resource type