Skip to content

Instantly share code, notes, and snippets.

View smallnest's full-sized avatar

smallnest smallnest

View GitHub Profile
@smallnest
smallnest / software_rdma.md
Created November 13, 2024 03:44 — forked from Chester-Gillon/software_rdma.md
Software RDMA interoperability

0. Introduction

Notes about software RDMA interoperability to communicate with hosts which have RDMA capable network adapters.

1. Documentation for software RDMA

Looked for documentation about how to use software RDMA

1.1 Red Hat Enterprise Linux 8

@smallnest
smallnest / token.go
Created October 31, 2024 04:18
switch-case vs table-finding
package main
import (
"fmt"
"strings"
"time"
)
func handleEventError(tokenName string, line, pos int) error {
err := fmt.Errorf("error at line %d, pos %d: %s", line, pos, tokenName)
;; 作者: 一泽Eze
;; 名称:创意名片生成
;; 版本: 1.0
;; 模型: Claude-3.5-sonnet
;; 用途: 根据公司Logo生成灵活、创意的名片模板,准确反映品牌调性
;; 定义未实现的函数(占位符)
(define (分析 elements)
;; 实现分析逻辑
'分析结果)
@smallnest
smallnest / udp.c
Created December 19, 2023 08:48 — forked from fntlnz/udp.c
XDP Drop udp example
#include <linux/bpf.h>
#include <linux/in.h>
#include <linux/if_ether.h>
#include <linux/ip.h>
#define SEC(NAME) __attribute__((section(NAME), used))
SEC("dropper_main")
int dropper(struct xdp_md *ctx) {
int ipsize = 0;
@smallnest
smallnest / xdp_manglepong.c
Created December 19, 2023 08:38 — forked from teknoraver/xdp_manglepong.c
Sample XDP program to mangle ICMP echo replies
/*
* xdp_manglepong.c - sample XDP program
* Copyright (C) 2019 Matteo Croce <mcroce@redhat.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@smallnest
smallnest / perf-tool.py
Created September 15, 2023 06:26 — forked from brandtg/perf-tool.py
A script that runs Netflix's "Linux Performance Analysis in 60,000 Milliseconds"
#!/usr/bin/env python
#
# A script that runs the commands to perform Netflix's
# "Linux Performance Analysis in 60,000 Milliseconds"
#
# (http://techblog.netflix.com/2015/11/linux-performance-analysis-in-60s.html)
#
import subprocess
import datetime
import argparse
@smallnest
smallnest / favicon.ico.go
Created July 30, 2023 08:14 — forked from nguyendangminh/favicon.ico.go
Serve favicon.ico in Golang
...
func faviconHandler(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "relative/path/to/favicon.ico")
}
...
func main() {
http.HandleFunc("/favicon.ico", faviconHandler)
}
$ 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.