Skip to content

Instantly share code, notes, and snippets.

View smallnest's full-sized avatar

smallnest smallnest

View GitHub Profile
$ go tool dist list
android/386
android/amd64
android/arm
android/arm64
darwin/386
darwin/amd64
darwin/arm
darwin/arm64
dragonfly/amd64
@smallnest
smallnest / syntax.s
Created September 12, 2022 02:07 — forked from mishurov/syntax.s
AT&T assembly syntax and IA-32 instructions
# --------
# Hardware
# --------
# Opcode - operational code
# Assebly mnemonic - abbreviation for an operation
# Instruction Code Format (IA-32)
# - Optional instruction prefix
# - Operational code
@smallnest
smallnest / Know Thy BPF: 01
Created June 4, 2022 10:27 — forked from errzey/Know Thy BPF: 01
Know Thy BPF
bpf filter: "ip"
(000) ldh [12]
(001) jeq #0x800 jt 2 jf 3
(002) ret #96
(003) ret #0
(000) ldh [12]
Load half word at packet offset 12
Offset 12 is the eth type.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
//
// This is just a collection of syscalls that are used by libsctp linux implementation.
// Although it supports message-oriented workflow, it can't be wrapped into a net.PacketConn.
//
package main
import (
"log"
"syscall"
@smallnest
smallnest / benchmark-commands.md
Created March 30, 2022 08:51 — forked from ueokande/benchmark-commands.md
Kafka Benchmark Commands

Benchmark commands

Producer

Setup

bin/kafka-topics.sh \
  --zookeeper zookeeper.example.com:2181 \
  --create \
@smallnest
smallnest / sql.go
Created March 21, 2022 05:48 — forked from PumpkinSeed/sql.go
Extension for sql package
func structScan(rows *sql.Rows, model interface{}) error {
v := reflect.ValueOf(model)
if v.Kind() != reflect.Ptr {
return errors.New("must pass a pointer, not a value, to StructScan destination") // @todo add new error message
}
v = reflect.Indirect(v)
t := v.Type()
cols, _ := rows.Columns()
@smallnest
smallnest / proxy.go
Created January 30, 2022 04:40 — forked from vmihailenco/proxy.go
Simple TCP proxy in Golang
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"
@smallnest
smallnest / client.go
Created January 11, 2022 08:05 — forked from mowings/client.go
Golang Websocket JSONRPC server and client
package main
import (
"golang.org/x/net/websocket"
"log"
"net/rpc/jsonrpc"
)
// In a real project, these would be defined in a common file
type Args struct {
@smallnest
smallnest / traceroute.go
Created December 8, 2021 12:57 — forked from niedbalski/traceroute.go
A small traceroute written in go
package main
import (
//"bufio"
"fmt"
"golang.org/x/net/icmp"
"golang.org/x/net/internal/iana"
"golang.org/x/net/ipv4"
"log"
"net"