Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Jaana Dogan rakyll

👋
View GitHub Profile
View golang-net-http-carbon-footprint.txt
BenchmarkServeMux-8 17066 73096 ns/op 17280 B/op 360 allocs/op 0.000017759620741 g CO2/op
BenchmarkServeMux_SkipServe-8 31587 36864 ns/op 0 B/op 0 allocs/op 0.000008956586667 g CO2/op
BenchmarkClientServer-8 11899 108704 ns/op 4738 B/op 58 allocs/op 0.000026411045926 g CO2/op
BenchmarkClientServerParallel4-8 10000 158806 ns/op 9013 B/op 75 allocs/op 0.000038583976296 g CO2/op
BenchmarkServer-8 9694 114669 ns/op 2241 B/op 20 allocs/op 0.000027860320000 g CO2/op
BenchmarkClient-8 10318 108927 ns/op 3247 B/op 42 allocs/op 0.000026465226667 g CO2/op
BenchmarkServerFakeConnNoKeepAlive-8 64522 18643 ns/op 4659 B/op 50 allocs/op 0.000004529558519 g CO2/op
BenchmarkServerFakeConnWithKeepAlive-8 118477 10268 ns/op 2440 B/op 22 alloc
@rakyll
rakyll / gcp-on-board
Last active Jul 24, 2019
Average HTTP latency to GCP regions onboard (SFO to SAN)
View gcp-on-board
0. [global] 787.975869ms
1. [us-west2] 834.117729ms
2. [us-central1] 886.366904ms
3. [us-east1] 896.880435ms
4. [us-east4] 897.410807ms
5. [northamerica-northeast1] 927.494263ms
6. [asia-northeast2] 1.016238175s
7. [europe-west2] 1.040375874s
8. [asia-northeast1] 1.04106759s
9. [europe-west3] 1.04748383s
View a.json
[ {"name": "GET /", "ph": "X", "ts": 123, "dur": 234, "pid": 2343, "tid": 2347,
"args": {
"first": 1,
"http.host": "google.com",
"http.path": "/"
} },
{"pid":64570,"tid":775,"ts":97240123396,"ph":"X","cat":"devtools.timeline","name":"XHRReadyStateChange","args":{"data":{"url":"https://help.github.com/enterprise/2.12/user/articles/about-pull-requests/","readyState":2,"frame":"8950C34E0C7436F9C0E4A0F9706A67EF"}},"dur":10,"tdur":11,"tts":7027341},
{"pid":64570,"tid":775,"ts":97240123476,"ph":"X","cat":"devtools.timeline","name":"XHRReadyStateChange","args":{"data":{"url":"https://help.github.com/enterprise/2.12/user/articles/about-pull-requests/","readyState":3,"frame":"8950C34E0C7436F9C0E4A0F9706A67EF"}},"dur":11,"tdur":10,"tts":7027422},
{"pid":64570,"tid":775,"ts":97240123796,"ph":"X","cat":"devtools.timeline","name":"XHRReadyStateChange","args":{"data":{"url":"https://help.github.com/enterprise/2.12/user/articles/about-pull-requests/","readyState":4,"frame":"8950C34E0C7436F9C0E4A0F9706A67EF"}},"dur
View gist:452e2e748a2a990ed5b8838861eafc12
s = status --short --branch --ignore-submodules=untracked
find = log --pretty=\"format:%Cgreen%H\n%s\n\n%b\" --name-status --grep
amend = commit --amend --no-edit
undo = reset HEAD~
upload = "!git push rakyll $(git rev-parse --abbrev-ref HEAD)"
prune = "!git co master && git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
delete = branch -D
pr = "!git fetch origin pull/$1/head:pr$1"
sync = "!git pull -q -r origin master"
@rakyll
rakyll / main.go
Created Jan 16, 2018
Go Spanner Client with OpenCensus
View main.go
// Copyright 2018 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Sample contains a simple program that
// uses Google Spanner Go client, and reports metrics
// and traces for the outgoing requests.
package main
import (
View livecaption.go
// Copyright 2016 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Command caption reads an audio file and outputs the transcript for it.
package main
import (
"fmt"
"io"
View main.go
$ go run main.go
fatal error: concurrent map writes
goroutine 34 [running]:
runtime.throw(0x89200, 0x15)
/Users/jbd/go/src/runtime/panic.go:530 +0x90 fp=0xc8200806d8 sp=0xc8200806c0
runtime.mapassign1(0x5e940, 0xc8200161e0, 0xc8200807a0, 0xc8200807a0)
/Users/jbd/go/src/runtime/hashmap.go:445 +0xb1 fp=0xc820080780 sp=0xc8200806d8
main.main.func1(0xc8200161e0, 0xc82000a170)
/Users/jbd/src/github.com/rakyll/experimental/maprace/main.go:11 +0x50 fp=0xc8200807b0 sp=0xc820080780
View README
You need to run tests with:
go test -tags=test
View gist:3b1cb2bfb46119c773b7
conf, err := google.NewServiceAccountJSONConfig(
"/Users/jbd/Downloads/burcu-gce-a44c472553f8.json",
storage.ScopeFullControl)
if err != nil {
log.Fatal(err)
}
b := storage.New(conf.NewTransport()).Bucket("bamboo-shift-504")
b.Copy("filename1", &storage.ObjectInfo{
Bucket: "another-bucket",
View gist:9d6d8b7aa7a3b05b7eba
{
"projection": [],
"kinds": [{
"name": "Company"
}],
"filter": {
"compositeFilter": {
"filters": [{
"propertyFilter": {
"property": {
You can’t perform that action at this time.