Skip to content

Instantly share code, notes, and snippets.

@tiborvass
tiborvass / main.go
Last active August 29, 2015 14:16
Hijacking Standard streams for Windows ANSI Emulation
package main
func Main() {
// everything that is currently in our main()
}
@tiborvass
tiborvass / gist:5aa8e698a3723fb48932
Created March 9, 2015 21:29
Debugging dockerfile bug (/bin/sh)
FROM scratch
COPY ./swarm /swarm
COPY ./certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
ENV SWARM_HOST :2375
EXPOSE 2375
VOLUME /.swarm
To get what's in this file, I did: docker run -it busybox sh
and then doing nothing else than keeping the Tab button down
=====================
/ # fatal error: unexpected signal during runtime execution
[signal 0xc0000005 code=0x0 addr=0xffffffffffffffff pc=0x42de56]
runtime stack:
runtime.MSpan_Sweep(0x1b6b78, 0x4d00000000, 0xc000000001)
/usr/local/go/src/runtime/mgc0.c:963 +0x166
time="2015-03-31T19:28:37.494759640Z" level=debug msg="waiting for daemon to initialize"
time="2015-03-31T19:28:37.496218761Z" level=debug msg="libdevmapper(6): ioctl/libdm-iface.c:1750 (4) dm version OF [16384] (*1)"
time="2015-03-31T19:28:37.496261859Z" level=debug msg="libdevmapper(6): ioctl/libdm-iface.c:1750 (4) dm version OF [16384] (*1)"
time="2015-03-31T19:28:37.496283007Z" level=warning msg="Udev sync is not supported. This will lead to unexpected behavior, data loss and errors"
time="2015-03-31T19:28:37.496297884Z" level=debug msg="devicemapper: udev sync support: false"
time="2015-03-31T19:28:37.496399045Z" level=debug msg="Generated prefix: docker-8:1-672147"
time="2015-03-31T19:28:37.496399793Z" level=debug msg="Checking for existence of the pool 'docker-8:1-672147-pool'"
time="2015-03-31T19:28:37.496462442Z" level=debug msg="libdevmapper(6): ioctl/libdm-iface.c:1750 (4) dm info docker-8:1-672147-pool OF [16384] (*1)"
time="2015-03-31T19:28:37.496579374Z" level=debug msg="Pool doesn't
package httputils
import (
"net/http"
"sync"
)
type StatusResponseWriter interface {
http.ResponseWriter
StatusSent() bool
Z:\windows>docker-1.5.0-dev.10864.exe run -it busybox sh
/ #
[ fsck lzma setserial
[[ fstrim makedevs setsid
addgroup fuser md5sum sh
adduser genl mdev sha1sum
ar getconf mesg sha256sum
arping getopt microcom sha3sum
ash getty mkdir sha512sum
awk grep mkfifo sleep
/ # panic: runtime error: index out of range
[
goroutine 12 [running]:
github.com/docker/docker/pkg/term/winconsole.clearDisplayRect(0x24, 0x700000020, 0xb1004900b00001, 0xc08210004b, 0xad, 0x0, 0x0)
/go/src/github.com/docker/docker/pkg/term/winconsole/console_windows.go:426 +0x288
github.com/docker/docker/pkg/term/winconsole.clearDisplayRange(0x24, 0x4000700000020, 0xb1004a00b00000, 0x4b, 0x0, 0x0, 0x0)
/go/src/github.com/docker/docker/pkg/term/winconsole/console_windows.go:461 +0x1f9
github.com/docker/docker/pkg/term/winconsole.(*WindowsTerminal).HandleOutputCommand(0xc082088cb0, 0x24, 0xc082064200, 0x3, 0x100, 0x3, 0x0, 0x0)
/go/src/github.com/docker/docker/pkg/term/winconsole/console_windows.go:743 +0xd47
github.com/docker/docker/pkg/term/winconsole.(*terminalWriter).Write(0xc08200a500, 0xc082101000, 0xb, 0x1000, 0xf04, 0x0, 0x0)
@tiborvass
tiborvass / test.go
Last active August 29, 2015 14:18
tls alpn test
MacBook-Pro:~ tibor$ go run /tmp/test.go # with protos=["proto1", "proto2"]
16 3 1 0 8d 1 0 0 89 3 3 26 22 8c d6 2d c9 9a 7f 4a(J) a7 1e e b7 f3 35(5) 4c(L) e8 27 81 ca 67(g) d0 d6 4e(N) 35(5) ab 5f ed b0 e5 d4 fc 0 0 1a c0 2f c0 2b c0 11 c0 7 c0 13 c0 9 c0 14 c0 a 0 5 0 2f 0 35(5) c0 12 0 a 1 0 0 46(F) 33(3) 74(t) 0 0 0 5 0 5 1 0 0 0 0 0 a 0 8 0 6 0 17 0 18 0 19 0 b 0 2 1 0 0 d 0 a 0 8 4 1 4 3 2 1 2 3 ff 1 0 1 0 0 10 0 10 0 e 6 70(p) 72(r) 6f(o) 74(t) 6f(o) 31(1) 6 70(p) 72(r) 6f(o) 74(t) 6f(o) 32(2)
2015/04/06 14:01:38 EOF
exit status 1
MacBook-Pro:~ tibor$ go run /tmp/test.go # with protos=["proto1", "proto2"]
16 3 1 0 8d 1 0 0 89 3 3 a7 b1 94 52(R) 14 d0 a4 28 f5 cf c 28 1e e8 74(t) ae 6d(m) d4 45(E) 8d 57(W) af db db 6c(l) 47(G) bb 1d e5 c9 d4 fc 0 0 1a c0 2f c0 2b c0 11 c0 7 c0 13 c0 9 c0 14 c0 a 0 5 0 2f 0 35(5) c0 12 0 a 1 0 0 46(F) 33(3) 74(t) 0 0 0 5 0 5 1 0 0 0 0 0 a 0 8 0 6 0 17 0 18 0 19 0 b 0 2 1 0 0 d 0 a 0 8 4 1 4 3 2 1 2 3 ff 1 0 1 0 0 10 0 10 0 e 6 70(p) 72(r) 6f(o) 74(t) 6f(o) 31(1) 6 70(p)
> [email protected] start /usr/src/app
> node app.js
error: Trying to use unknown adapter, "sails-postgresql", in model `certifications`.
error: Are you sure that adapter is installed in this Sails app?
error: If you wrote a custom adapter with identity="sails-postgresql", it should be in this app's adapters directory.
error: Otherwise, if you're trying to use an adapter named `sails-postgresql`, please run `npm install [email protected]`
npm ERR! Linux 3.18.5-tinycore64
@tiborvass
tiborvass / gist:583779b76e7a5f2b31a6
Last active August 29, 2015 14:20
Verifying copy/pastes of Go functions when refactoring
f=functionName; for x in '-' '+'; do git diff origin/pull/$PR^ origin/pull/$PR | awk '/^\'$x'func .* '$f'\(/,/^\'$x'[ '$'\t'']*\}/ { print }' | sed 's/^\'$x'//' > /tmp/$x; done; diff -u /tmp/{-,+}