Skip to content

Instantly share code, notes, and snippets.

View gist:7aac2021d419154d4b1d02e207e20335
diff --git a/device/device.go b/device/device.go
index 5644c8a..db017b6 100644
--- a/device/device.go
+++ b/device/device.go
@@ -44,6 +44,7 @@ type Device struct {
netlinkCancel *rwcancel.RWCancel
port uint16 // listening port
fwmark uint32 // mark value (0 = disabled)
+ brokenRoaming AtomicBool
}
View acl2dot.go
package main
import (
"log"
"os"
"strings"
"github.com/goccy/go-graphviz"
"github.com/goccy/go-graphviz/cgraph"
"github.com/tailscale/hujson"
@josharian
josharian / md5block.go
Created Nov 3, 2021
rewrite of generic md5 go code to be friendlier to the register allocator
View md5block.go
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated by go run gen.go -output md5block.go; DO NOT EDIT.
package md5
import (
// "encoding/binary"
@josharian
josharian / iossize.go
Last active Aug 13, 2021
calculate dirty data pages for macho binary
View iossize.go
// Command iossize predicts the impact
// on memory usage of changes to the binary.
//
// This implementation uses dyldinfo to determine
// exactly how much memory the dynamic linker will dirty
// as part of launching the executable.
//
// It is not perfect. There are multiple sources of dirty pages:
//
// 1. dynamic loader rebase/relocs due to our code
View lldb_out.txt
(lldb) bt
* thread #14, stop reason = EXC_BAD_ACCESS (code=2, address=0x70000228b000)
* frame #0: 0x0000000004b88761 bug.report.test`Builtins_CallVarargs + 97
frame #1: 0x0000000004b8fb81 bug.report.test`Builtins_InterpreterEntryTrampoline + 225
frame #2: 0x000007740009a3e2
frame #3: 0x0000000004b8fb81 bug.report.test`Builtins_InterpreterEntryTrampoline + 225
frame #4: 0x0000000004b8fb81 bug.report.test`Builtins_InterpreterEntryTrampoline + 225
frame #5: 0x0000000004b8fb81 bug.report.test`Builtins_InterpreterEntryTrampoline + 225
frame #6: 0x0000000004b8fb81 bug.report.test`Builtins_InterpreterEntryTrampoline + 225
frame #7: 0x0000000004b8fb81 bug.report.test`Builtins_InterpreterEntryTrampoline + 225
View gist:6021b95602f3ae70820bf20ec80147ee
[Trace - 15:51:36.049 PM] Sending request 'initialize - (0)'.
Params: {"processId":79571,"clientInfo":{"name":"vscode","version":"1.48.0"},"rootPath":"/Users/josh/src/vscb","rootUri":"file:///Users/josh/src/vscb","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional"},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"tagSupport":{"valueSet":[1,2]}},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionI
View gist:8988e3c49fe5544d1e5808248a776c0e
[Trace - 15:49:20.016 PM] Sending request 'initialize - (0)'.
Params: {"processId":78921,"clientInfo":{"name":"vscode","version":"1.48.0"},"rootPath":"/Users/josh/src/vscb","rootUri":"file:///Users/josh/src/vscb","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional"},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"tagSupport":{"valueSet":[1,2]}},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionI
View transcript.txt
[Trace - 14:15:20.682 PM] Sending request 'initialize - (0)'.
Params: {"processId":76152,"clientInfo":{"name":"vscode","version":"1.47.3"},"rootPath":"/Users/josh/src/github.com/josharian/vscb","rootUri":"file:///Users/josh/src/github.com/josharian/vscb","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional"},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"tagSupport":{"valueSet":[1,2]}},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistratio
View goroutines.txt
goroutine profile: total 48
10 @ 0x1038570 0x10484d3 0x142a762 0x14fa5ed 0x1490f96 0x1067b91
# 0x142a761 github.com/pion/transport/packetio.(*Buffer).Read+0x141 /Users/josh/pkg/mod/github.com/pion/transport@v0.10.0/packetio/buffer.go:146
# 0x14fa5ec github.com/pion/webrtc/v2/internal/mux.(*Endpoint).Read+0x4c /Users/josh/pkg/mod/github.com/pion/webrtc/v2@v2.2.15-0.20200606101323-d41427855005/internal/mux/endpoint.go:36
# 0x1490f95 github.com/pion/srtp.(*session).start.func1+0xb5 /Users/josh/pkg/mod/github.com/pion/srtp@v1.3.4/session.go:130
5 @ 0x1038570 0x1007b37 0x100783b 0x148b815 0x1528dd2 0x1067b91
# 0x148b814 github.com/pion/srtp.(*SessionSRTCP).AcceptStream+0x44 /Users/josh/pkg/mod/github.com/pion/srtp@v1.3.4/session_srtcp.go:92
# 0x1528dd1 github.com/pion/webrtc/v2.(*PeerConnection).drainSRTP.func3+0xa1 /Users/josh/pkg/mod/github.com/pion/webrtc/v2@v2.2.15-0.20200606101323-d41427855005/peerconnection.go:1102
@josharian
josharian / main.go
Created May 23, 2020
play opus audio to any browser that connects
View main.go
// Demo of playing opus audio into a webrtc session on macOS.
// To install required packages/commands:
// brew install ffmpeg pkg-config opus opusfile
// Then run this server, and visit http://localhost:2021/ in a browser.
package main
import (
"encoding/binary"
"encoding/json"