Skip to content

Instantly share code, notes, and snippets.

View bradfitz's full-sized avatar
🍃
On parental leave from Tailscale

Brad Fitzpatrick bradfitz

🍃
On parental leave from Tailscale
View GitHub Profile
@bradfitz
bradfitz / gist:79467dd4915a7a269e33
Created December 17, 2014 01:56
Making boot2docker work
Reboot your Mac. (this was actually a required step for me)
mac:~ bradfitz$ rm -rf .ssh/id_boot2docker* ~/Library/VirtualBox/ ~/.boot2docker/ ~/VirtualBox\ VMs/
mac:~ bradfitz$ boot2docker version
Boot2Docker-cli version: v1.4.0
Git commit: 583f714
mac:~ bradfitz$ boot2docker init
Latest release for boot2docker/boot2docker is v1.4.1
@bradfitz
bradfitz / chat.go
Created February 6, 2015 01:12
terrible hello world chat server
package main
import (
"bufio"
"fmt"
"log"
"net"
"strings"
"sync"
)
$ h2i
Usage: h2i <hostname>
-insecure
Whether to skip TLS cert validation
-nextproto string
Comma-separated list of NPN/ALPN protocol names to negotiate. (default "h2,h2-14")
$ h2i google.com
Connecting to google.com:443 ...
Connected to 74.125.224.41:443
@bradfitz
bradfitz / nope.go
Created August 16, 2015 16:18
nope gophers
package main
import (
"bytes"
"image"
"image/color"
"image/png"
"log"
"math/rand"
"net"
package main
import (
"bytes"
"flag"
"image"
"image/color"
"image/png"
"log"
"math/rand"
@bradfitz
bradfitz / xmas.go
Created December 25, 2015 02:39
Brad's xmas lights
// Copyright 2015 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@bradfitz
bradfitz / dlgo.go
Created March 11, 2016 15:44
program to download Go
package main
import (
"bytes"
"crypto/x509"
"encoding/hex"
"flag"
"io"
"log"
"net/http"
pkg archive/tar, func FileInfoHeader(os.FileInfo, string) (*Header, error)
pkg archive/tar, method (*Reader) Next() (*Header, error)
pkg archive/tar, method (*Reader) Read([]uint8) (int, error)
pkg archive/tar, method (*Writer) Close() error
pkg archive/tar, method (*Writer) Flush() error
pkg archive/tar, method (*Writer) WriteHeader(*Header) error
pkg archive/tar, method (*Writer) Write([]uint8) (int, error)
pkg archive/zip, func FileInfoHeader(os.FileInfo) (*FileHeader, error)
pkg archive/zip, func NewReader(io.ReaderAt, int64) (*Reader, error)
pkg archive/zip, func OpenReader(string) (*ReadCloser, error)
+ ANITA_VERSION=1.39
+ ARCH=amd64
+ RELEASE=7.0
+ TAR=tar
+ which gtar
+ WORKDIR=work-NetBSD-amd64
+ sha1sum -c anita-1.39.tar.gz.sha1
anita-1.39.tar.gz: OK
+ tar xfz anita-1.39.tar.gz
+ cd anita-1.39
goroutine 19860 [running]:
camlistore.org/pkg/serverinit.dumpGoroutines(0x145ac60, 0xc87493c008, 0xc8209e40f0)
/home/bradfitz/src/camlistore.org/tmp/build-gopath-nosqlite/src/camlistore.org/pkg/serverinit/serverinit.go:606 +0x6a
net/http.HandlerFunc.ServeHTTP(0x109c5c0, 0x145ac60, 0xc87493c008, 0xc8209e40f0)
/home/bradfitz/go/src/net/http/server.go:1663 +0x3a
net/http.(*ServeMux).ServeHTTP(0xc8206fbc50, 0x145ac60, 0xc87493c008, 0xc8209e40f0)
/home/bradfitz/go/src/net/http/server.go:1959 +0x75
camlistore.org/pkg/webserver.(*Server).ServeHTTP(0xc8209ccb80, 0x145ac60, 0xc87493c008, 0xc8209e40f0)
/home/bradfitz/src/camlistore.org/tmp/build-gopath-nosqlite/src/camlistore.org/pkg/webserver/webserver.go:127 +0x9a
net/http.serverHandler.ServeHTTP(0xc85c9b8000, 0x145ac60, 0xc87493c008, 0xc8209e40f0)