Skip to content

Instantly share code, notes, and snippets.

View lggomez's full-sized avatar
👶
Oh my

Luis Gabriel Gomez lggomez

👶
Oh my
View GitHub Profile
@lggomez
lggomez / tcpdump cheat sheet
Created July 6, 2023 12:56 — forked from githubfoam/tcpdump cheat sheet
tcpdump cheat sheet
----------------------------------------------------------------------------------------------------
tcpdump -s 0 #capture entire etherner header and IP packet
tcpdump -ni tap55ec3c7f-91 ip6 #locate the ICMPv6 packets
tcpdump -s0 -n -i any -w /tmp/$(hostname)-smbtrace.pcap #if the SMB client or SMB server is a Unix host,Troubleshooting Server Message Block (SMB)
tcpdump -D #Print the list of the network interfaces available on the system and on which tcpdump can capture packet
tcpdump -X -vvv -n -i eth0
@lggomez
lggomez / stacktrace.go
Created July 26, 2021 15:55 — forked from lggomezml/stacktrace.go
Get a compact stacktrace without the callsites
var newLine = []byte("\n")[0]
var goPathPrefix = "\t/go/src/"
var goUsersPrefix = "\t/Users/"
func dumpStacktrace(skipLines int) []byte {
stack := debug.Stack()
init, lines := 0, 0
// First pass: seek stack start skiping lines if necessary
if skipLines > 0 {
@lggomez
lggomez / go_cpu_memory_profiling_benchmarks.sh
Last active July 2, 2021 14:54 — forked from arsham/go_cpu_memory_profiling_benchmarks.sh
Go cpu and memory profiling benchmarks. #golang #benchmark
# Run tests for package in current location
go test -run=. -bench=. -benchtime=5s -count 5 -benchmem -cpuprofile=cpu.out -memprofile=mem.out -trace=trace.out ./ | tee bench.txt
go tool pprof -http :8080 cpu.out
go tool pprof -http :8081 mem.out
go tool trace trace.out
go tool pprof $FILENAME.test cpu.out
# (pprof) list <func name>
# go get -u golang.org/x/perf/cmd/benchstat