• Memory

    时间从来不是治愈的良药,人才是。#甜蜜蜜#

  • shell bomb

    https://www.cyberciti.biz/faq/understanding-bash-fork-bomb/

  • vim中自动补全的颜色调整

    exec “hi PMenu “ . “ guifg=#” . a:fg . “ ctermfg=” . a:fg

    exec “hi PMenu” . “ guibg=#” . a:bg . “ ctermbg=” . a:bg

    exec “hi PMenu” . “ gui=” . a:attr . “ cterm=” . a:attr

  • Unshare

    https://man7.org/linux/man-pages/man1/unshare.1.html

    The unshare command creates new namespaces (as specified by the command-line options described below) and then executes the specified program. If program is not given, then “${SHELL}” is run (default: /bin/sh).

    https://www.youtube.com/watch?app=desktop&v=8fi7uSYlOdc&feature=youtu.be

  • 逃避

    当问题不能逃避时,解决问题才是必要的。

    如果能逃避的话,逃避多简单啊,逃避本身就是解决问题。

  • Kafka Get Topic Offset

    ./bin/kafka-run-class.sh kafka.tools.GetOffsetShell –broker-list node1.kafka.es.ops.fraaws.tripws.com:9092 –topic cloud-harbor-registry

  • Setuid

    File modes The setuid and setgid bits are normally represented as the values 4 for setuid and 2 for setgid in the high-order octal digit of the file mode. For example, 6711 has both the setuid and setgid bits (4 + 2 = 6) set, and also the file read/write/executable for the owner (7), and executable by the group (first 1) and others (second 1). Most implementations have a symbolic representation of these bits; in the previous example, this could be u=rwx,go=x,ug+s.

    Typically, chmod does not have a recursive mode restricted to directories, so modifying an existing directory tree must be done manually, with a command such as find /path/to/directory -type d -exec chmod g+s ‘{}’ ‘'.

    Effects The setuid and setgid flags have different effects, depending on whether they are applied to a file, to a directory or binary executable or non binary executable file. The setuid and setgid flags have an effect only on binary executable files and not on scripts (e.g., Bash, Perl, Python).[3]

    When set on an executable file When the setuid or setgid attributes are set on an executable file, then any users able to execute the file will automatically execute the file with the privileges of the file’s owner (commonly root) and/or the file’s group, depending upon the flags set.[2] This allows the system designer to permit trusted programs to be run which a user would otherwise not be allowed to execute. These may not always be obvious. For example, the ping command may need access to networking privileges that a normal user cannot access; therefore it may be given the setuid flag to ensure that a user who needs to ping another system can do so, even if their own account does not have the required privilege for sending packets.

  • Tcp Error Ack

    如果 tcp 数据里面的 ack 是错误的,会发生什么呢?

  • Golang Broken Pipe

    https://gosamples.dev/broken-pipe/

    package main
    
    import (
    	"errors"
    	"log"
    	"net"
    	"os"
    	"syscall"
    	"time"
    )
    
    func server() {
    	listener, err := net.Listen("tcp", ":8080")
    	if err != nil {
    		log.Fatal(err)
    	}
    
    	defer listener.Close()
    
    	conn, err := listener.Accept()
    	if err != nil {
    		log.Fatal("server", err)
    		os.Exit(1)
    	}
    	data := make([]byte, 1)
    	if _, err := conn.Read(data); err != nil {
    		log.Fatal("server", err)
    	}
    
    	conn.Close()
    }
    
    func client() {
    	conn, err := net.Dial("tcp", "localhost:8080")
    	if err != nil {
    		log.Fatal("client", err)
    	}
    
    	// write to make the connection closed on the server side
    	if n, err := conn.Write([]byte("a")); err != nil {
    		log.Printf("client: %v", err)
    	} else {
    		log.Printf("client: %d", n)
    	}
    
    	time.Sleep(1 * time.Second)
    
    	// write to generate an RST packet
    	if _, err := conn.Write([]byte("b")); err != nil {
    		log.Printf("client: %v", err)
    	}
    
    	time.Sleep(1 * time.Second)
    
    	// write to generate the broken pipe error
    	if _, err := conn.Write([]byte("c")); err != nil {
    		log.Printf("client: %v", err)
    		if errors.Is(err, syscall.EPIPE) {
    			log.Print("This is broken pipe error")
    		}
    	}
    }
    
    func main() {
    	go server()
    
    	time.Sleep(3 * time.Second) // wait for server to run
    
    	client()
    }
    
  • Prlimit

    prlimit 可以通过系统调用更改一下进程的 limit 值。

    /proc/pid/limit 查看进程 limit