Skip to content

Instantly share code, notes, and snippets.

View bradfitz's full-sized avatar

Brad Fitzpatrick bradfitz

View GitHub Profile
root@ss1:~# pveceph createosd /dev/sda --wal_dev=/dev/sdc1 --journal_dev=/dev/sdc2
create OSD on /dev/sda (bluestore)
using device '/dev/sdc2' for block.db
using device '/dev/sdc1' for block.wal
Creating new GPT entries.
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Creating new GPT entries.
The operation has completed successfully.
Setting name!
func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFrame) (*http.Response, error) {
if f.Truncated {
return nil, errResponseHeaderListSize
@@ -1750,15 +1762,6 @@ func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFra
return nil, errors.New("malformed response from server: malformed non-numeric status pseudo header")
}
- if statusCode == 100 {
- traceGot100Continue(cs.trace)
- if cs.on100 != nil {
package main
import (
"crypto/tls"
"flag"
"io"
"log"
)
var once = flag.Bool("once", false, "just send one settings fame")
root@debian:~# dd if=/dev/sda of=out bs=1M count=1
1+0 records in
1+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.00404595 s, 259 MB/s
root@debian:~# hd out
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001c0 01 00 ee fe ff ff 01 00 00 00 ff ff 9f 00 00 00 |................|
000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
@bradfitz
bradfitz / amp.go
Last active July 23, 2018 15:28
Sonos amp control
// turnAmp controls the mPower Mini unit in Barloga, which
// powers the rainbow Google Chord AMP hooked up to the speakers.
func turnAmp(on bool) bool {
c, err := ssh.Dial("tcp", "10.0.0.nnnn:22", &ssh.ClientConfig{
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
Config: ssh.Config{
Ciphers: []string{"aes128-cbc"},
},
User: "ubnt",
Auth: []ssh.AuthMethod{ssh.Password("xxxxx")},
./vendor
./vendor/golang_org
./vendor/golang_org/x
./vendor/golang_org/x/crypto
./vendor/golang_org/x/crypto/internal
./vendor/golang_org/x/crypto/internal/chacha20
./vendor/golang_org/x/crypto/chacha20poly1305
./vendor/golang_org/x/crypto/cryptobyte
./vendor/golang_org/x/crypto/cryptobyte/asn1
./vendor/golang_org/x/crypto/curve25519
@bradfitz
bradfitz / hasswrap.go
Created August 17, 2018 04:28
Home Assistant wrapper
package main
import (
"flag"
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
"syscall"
@bradfitz
bradfitz / ws.go
Created November 5, 2018 17:06
pre-Go1.12 websocket hijack+proxy
httpsServer := &http.Server{
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
hj, isHJ := w.(http.Hijacker)
if r.Header.Get("Upgrade") == "websocket" && isHJ {
c, br, err := hj.Hijack()
if err != nil {
log.Printf("websocket websocket hijack: %v", err)
http.Error(w, err.Error(), 500)
return
}
FROM debian:stretch
RUN apt-get update
RUN apt-get install --yes subversion autoconf automake gcc
RUN apt-get install --yes libgmp-dev libmpfr-dev libmpc-dev
RUN apt-get install --yes make
RUN apt-get install --yes file cpp
RUN mkdir /opt/gccgo
RUN mkdir /src
root@gw:/etc/ppp/peers# systemctl status centurylink
● centurylink.service - PPPoE to Centurylink
Loaded: loaded (/etc/systemd/system/centurylink.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2018-11-19 11:41:02 PST; 2min 14s ago
Process: 1136 ExecStartPre=/usr/local/bin/setup-ipv6.sh (code=exited, status=0/SUCCESS)
Main PID: 1157 (pppd)
Tasks: 1 (limit: 4720)
CGroup: /system.slice/centurylink.service
└─1157 /usr/sbin/pppd call centurylink nodetach logfd 1