Skip to content

Instantly share code, notes, and snippets.

@pciet
pciet / text.pov
Created May 11, 2020 14:21
The source code for the cover of my "Text" electronic music album.
#version 3.7;
global_settings {
assumed_gamma 1.0
ambient_light 0
}
camera {
location <-9,-9,0>
up <0,0,1>
// insecure implementation, the session key cookie should be Secure and HttpOnly in a final version
import (
"database/sql"
_ "github.com/lib/pq"
)
type DB struct {
*sql.DB
@pciet
pciet / gist:80090026c62838bf8dd3593d09e3f58d
Created January 24, 2018 17:57
load testing: deadlock
goroutine 94615397 [running]:
runtime/pprof.writeGoroutineStacks(0x8a25a0, 0xc43072c620, 0x411f09, 0xc420466630)
/home/pciet/sdk/go1.10beta2/src/runtime/pprof/pprof.go:648 +0xa7
runtime/pprof.writeGoroutine(0x8a25a0, 0xc43072c620, 0x2, 0xc4203e2c00, 0xc423133ad0)
/home/pciet/sdk/go1.10beta2/src/runtime/pprof/pprof.go:637 +0x44
runtime/pprof.(*Profile).WriteTo(0xa8bd80, 0x8a25a0, 0xc43072c620, 0x2, 0xc43072c620, 0x8a2d00)
/home/pciet/sdk/go1.10beta2/src/runtime/pprof/pprof.go:310 +0x3d0
net/http/pprof.handler.ServeHTTP(0xc42090a2b1, 0x9, 0x8a5a00, 0xc43072c620, 0xc424f54300)
/home/pciet/sdk/go1.10beta2/src/net/http/pprof/pprof.go:237 +0x19a
net/http/pprof.Index(0x8a5a00, 0xc43072c620, 0xc424f54300)
goroutine 1142411 [running]:
runtime/pprof.writeGoroutineStacks(0x8a25a0, 0xc421b9a0e0, 0x411f09, 0xc42201e210)
/home/pciet/sdk/go1.10beta2/src/runtime/pprof/pprof.go:648 +0xa7
runtime/pprof.writeGoroutine(0x8a25a0, 0xc421b9a0e0, 0x2, 0xc420257800, 0xc420628ad0)
/home/pciet/sdk/go1.10beta2/src/runtime/pprof/pprof.go:637 +0x44
runtime/pprof.(*Profile).WriteTo(0xa8bd80, 0x8a25a0, 0xc421b9a0e0, 0x2, 0xc421b9a0e0, 0x8a2d00)
/home/pciet/sdk/go1.10beta2/src/runtime/pprof/pprof.go:310 +0x3d0
net/http/pprof.handler.ServeHTTP(0xc42002a1f1, 0x9, 0x8a5a00, 0xc421b9a0e0, 0xc42015c100)
/home/pciet/sdk/go1.10beta2/src/net/http/pprof/pprof.go:237 +0x19a
net/http/pprof.Index(0x8a5a00, 0xc421b9a0e0, 0xc42015c100)
// wins for container types is compile-time type check without a wrapper type
// but now a Value() method is required on the contained item interface instead of using a type assertion
type Comparable interface {
Equal(Ť) bool
Value() Ť
}
type EqualSet []Comparable
@pciet
pciet / gist:5ae0157528c8db08a196508061044552
Created January 19, 2018 14:56
deadlock in load testing 2
goroutine 15111983 [running]:
runtime/pprof.writeGoroutineStacks(0x8a24a0, 0xc423b58380, 0x411f09, 0xc4227e62a0)
/home/pciet/sdk/go1.10beta2/src/runtime/pprof/pprof.go:648 +0xa7
runtime/pprof.writeGoroutine(0x8a24a0, 0xc423b58380, 0x2, 0xc42007c400, 0xc4217c4ad0)
/home/pciet/sdk/go1.10beta2/src/runtime/pprof/pprof.go:637 +0x44
runtime/pprof.(*Profile).WriteTo(0xa8bd80, 0x8a24a0, 0xc423b58380, 0x2, 0xc423b58380, 0x8a2c00)
/home/pciet/sdk/go1.10beta2/src/runtime/pprof/pprof.go:310 +0x3d0
net/http/pprof.handler.ServeHTTP(0xc4211e2041, 0x9, 0x8a5900, 0xc423b58380, 0xc42041e400)
/home/pciet/sdk/go1.10beta2/src/net/http/pprof/pprof.go:237 +0x19a
net/http/pprof.Index(0x8a5900, 0xc423b58380, 0xc42041e400)
@pciet
pciet / gist:f395696be42c3c9d6bcdaf71c7708657
Created January 17, 2018 21:49
deadlock in load testing
goroutine 15753302 [running]:
runtime/pprof.writeGoroutineStacks(0x89d700, 0xc4398240e0, 0x411f09, 0xc42aaa2270)
/home/pciet/sdk/go1.10beta2/src/runtime/pprof/pprof.go:648 +0xa7
runtime/pprof.writeGoroutine(0x89d700, 0xc4398240e0, 0x2, 0xc4204b8c00, 0x89d4a0)
/home/pciet/sdk/go1.10beta2/src/runtime/pprof/pprof.go:637 +0x44
runtime/pprof.(*Profile).WriteTo(0xa86d80, 0x89d700, 0xc4398240e0, 0x2, 0xc4398240e0, 0x89de60)
/home/pciet/sdk/go1.10beta2/src/runtime/pprof/pprof.go:310 +0x3d0
net/http/pprof.handler.ServeHTTP(0xc429f74101, 0x9, 0x8a0b60, 0xc4398240e0, 0xc42f544600)
/home/pciet/sdk/go1.10beta2/src/net/http/pprof/pprof.go:237 +0x19a
net/http/pprof.Index(0x8a0b60, 0xc4398240e0, 0xc42f544600)
@pciet
pciet / gist:4edd4f21d238a24165af65f8dfc29e6c
Created December 8, 2017 16:15
deadlock during load testing: 100 max open connections
goroutine 1043295 [running]:
runtime/pprof.writeGoroutineStacks(0x88ef40, 0xc422b08380, 0x411ee9, 0xc4207343c0)
/home/pciet/sdk/go1.10beta1/src/runtime/pprof/pprof.go:648 +0xa7
runtime/pprof.writeGoroutine(0x88ef40, 0xc422b08380, 0x2, 0xc420150000, 0xc420372ad0)
/home/pciet/sdk/go1.10beta1/src/runtime/pprof/pprof.go:637 +0x44
runtime/pprof.(*Profile).WriteTo(0xa73d80, 0x88ef40, 0xc422b08380, 0x2, 0xc422b08380, 0x42bd04)
/home/pciet/sdk/go1.10beta1/src/runtime/pprof/pprof.go:310 +0x3d0
net/http/pprof.handler.ServeHTTP(0xc4216e8011, 0x9, 0x892240, 0xc422b08380, 0xc420924200)
/home/pciet/sdk/go1.10beta1/src/net/http/pprof/pprof.go:237 +0x19a
net/http/pprof.Index(0x892240, 0xc422b08380, 0xc420924200)
@pciet
pciet / gist:37b16e06ac41cfbe959c2fe6ba217a05
Created December 8, 2017 14:42
deadlock during load test excerpt
(client49) POST http://192.168.0.104:8080/competitive15: {"assignments":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}
(client34) RECV DIFF: map[0-0:(5 white) 2-1:(0 white)]
(client34) GET http://192.168.0.104:8080/moves/262?Turn=198
(client24) WAIT DIFF
(client24) RECV DIFF: map[1-3:(1 black) 2-2:(0 white)]
(client24) GET http://192.168.0.104:8080/moves/253?Turn=202
(client46) RECV DIFF: map[1-6:(30 black) 2-7:(0 white)]
(client46) GET http://192.168.0.104:8080/moves/284?Turn=62
(client40) POST 0-1 0-0 http://192.168.0.104:8080/move/247
(client67) GET http://192.168.0.104:8080/moves/266?Turn=115
@pciet
pciet / gist:6874c1af77eb41e9f135de2e29332389
Created December 8, 2017 14:38
wichess load test deadlock stack trace
goroutine 1203036 [running]:
runtime/pprof.writeGoroutineStacks(0x88ef40, 0xc423402000, 0x411ee9, 0xc420a4c2a0)
/home/pciet/sdk/go1.10beta1/src/runtime/pprof/pprof.go:648 +0xa7
runtime/pprof.writeGoroutine(0x88ef40, 0xc423402000, 0x2, 0xc42035e800, 0xc420267ad0)
/home/pciet/sdk/go1.10beta1/src/runtime/pprof/pprof.go:637 +0x44
runtime/pprof.(*Profile).WriteTo(0xa73d80, 0x88ef40, 0xc423402000, 0x2, 0xc423402000, 0x42bd04)
/home/pciet/sdk/go1.10beta1/src/runtime/pprof/pprof.go:310 +0x3d0
net/http/pprof.handler.ServeHTTP(0xc420694041, 0x9, 0x892240, 0xc423402000, 0xc421e74200)
/home/pciet/sdk/go1.10beta1/src/net/http/pprof/pprof.go:237 +0x19a
net/http/pprof.Index(0x892240, 0xc423402000, 0xc421e74200)