Skip to content

Instantly share code, notes, and snippets.

@timoyuen
timoyuen / README.md
Created March 4, 2019 23:32 — forked from jirikuncar/README.md
Traefik - header matching

Traefik routing

Proxy to services based on Accept header.

Run

docker-compose up -d

Test

version: '3'
services:
frontproxy:
image: traefik
command: --api --docker
ports:
- "80:80"
- "443:443"
volumes:
@timoyuen
timoyuen / cookie_jar_golang.go
Created February 1, 2019 02:47 — forked from varver/cookie_jar_golang.go
Login to a website with this golang code using persistent cookies or cookie jar .

Here's the canonical TOML example from the TOML README, and a YAML version of the same. Which looks nicer?

title = "TOML Example"

[owner] name = "Tom Preston-Werner"

@timoyuen
timoyuen / 1_kubernetes_on_macOS.md
Created January 11, 2019 13:01 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@timoyuen
timoyuen / graphql-example.js
Created January 2, 2019 05:36 — forked from everdimension/graphql-example.js
simplified graphql explanation
// Say we need to display list of posts showing *only* their titles
// and name of the post author
// without graphql
const data = {
posts: null,
usersById: {},
};
get('/api/posts')
@timoyuen
timoyuen / .dockerignore
Created December 6, 2018 08:49 — forked from remarkablemark/.dockerignore
Docker Node.js Example
node_modules/
*.log
@timoyuen
timoyuen / middleware.go
Created October 31, 2018 23:55 — forked from stefanwuthrich/middleware.go
Casbin Authorization for qiangxue/golang-restful-starter-kit
package util
import (
"net/http"
"github.com/casbin/casbin"
"github.com/qiangxue/golang-restful-starter-kit/app"
"github.com/go-ozzo/ozzo-routing"
)
// Authorizer is a middleware that controls the access to the HTTP service, it is based
@timoyuen
timoyuen / .drone.yml
Created October 30, 2018 08:27 — forked from d0x2f/.drone.yml
.drone.yml example
workspace:
base: /build
pipeline:
dbnode1:
detach: true
image: mysql/mysql-cluster:7.5
commands:
- sleep 5
@timoyuen
timoyuen / dump-restore
Created July 25, 2018 02:34 — forked from ricjcosme/dump-restore
DUMP / RESTORE PostgreSQL Kubernetes
DUMP
// pod-name name of the postgres pod
// postgres-user database user that is able to access the database
// database-name name of the database
kubectl exec [pod-name] -- bash -c "pg_dump -U [postgres-user] [database-name]" > database.sql
RESTORE
// pod-name name of the postgres pod
// postgres-user database user that is able to access the database
// database-name name of the database