Skip to content

Instantly share code, notes, and snippets.

View weidonglian's full-sized avatar

Weidong Lian weidonglian

View GitHub Profile
@weidonglian
weidonglian / docker-compose.yml
Created October 23, 2022 11:04 — forked from oxlb/docker-compose.yml
cloud-spanner
version: '3'
services:
spanner:
image: gcr.io/cloud-spanner-emulator/emulator:latest
ports:
- "9010:9010"
- "9020:9020"
gcloud-spanner-init:
image: gcr.io/google.com/cloudsdktool/cloud-sdk:latest
//
// Companion code to https://medium.com/statuscode/pipeline-patterns-in-go-a37bb3a7e61d
//
// To run:
// go get github.com/pkg/errors
// go run -race pipeline_demo.go
//
package main
@GLMeece
GLMeece / latency_numbers.md
Last active May 22, 2024 15:57
Latency Numbers Every Programmer Should Know - MarkDown Fork

Latency Comparison Numbers

Note: "Forked" from Latency Numbers Every Programmer Should Know

Event Nanoseconds Microseconds Milliseconds Comparison
L1 cache reference 0.5 - - -
Branch mispredict 5.0 - - -
L2 cache reference 7.0 - - 14x L1 cache
Mutex lock/unlock 25.0 - - -
@warpfork
warpfork / practices-golang-plugin-patterns.md
Created May 31, 2016 16:00
Golang Practices: Patterns for "plugin" Package Layouts

wise choices for plugin patterns in golang

Any time you use an interface, really -- if it's a small one, you might cram everything into one package. If it's not small... you need to decide how to lay out your packaging!

Phase 1: Declare interfaces and API data types in a top level package

Put all the interfaces (and, any other structures that are completely shared data types and part of the general API) in one package. This is the stuff that most of your program is referring to already, so this is a process of making those boundaries explicit.

@andrewmilson
andrewmilson / file-upload-multipart.go
Last active August 25, 2024 13:04
Golang multipart/form-data File Upload
package main
import (
"net/http"
"os"
"bytes"
"path"
"path/filepath"
"mime/multipart"
"io"
@staltz
staltz / introrx.md
Last active September 20, 2024 10:10
The introduction to Reactive Programming you've been missing