Skip to content

Instantly share code, notes, and snippets.

View zdyxry's full-sized avatar
🖖
Focusing

Yiran Zhou zdyxry

🖖
Focusing
View GitHub Profile
@kdrag0n
kdrag0n / README.md
Last active July 29, 2023 04:46
Fast, polling-free approach to kill and wait for all processes to exit. Rust + Tokio, pidfd + epoll + timer
@beriberikix
beriberikix / QEMU_cheat_sheat.md
Last active July 10, 2024 09:20
QEMU cheat sheet for the most basic setup

Create system drive

qemu-img create -f qcow2 alpine.qcow2 16G

Install image

Linux

@leolara
leolara / publisher.go
Last active April 29, 2023 04:30
Example in Go of how to close a channel written by several goroutines
// Package gochannels example of how to close a channel written by several goroutines
package gochannels
import (
"math/big"
"sync"
)
// Publisher write sequences of big.Int into a channel
type Publisher struct {
@stewartpark
stewartpark / oom-killer.yml
Last active April 21, 2023 23:04
Userspace Early OOM Killer for Kubernetes Nodes
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: oom-killer
namespace: kube-system
labels:
k8s-app: oom-killer
spec:
selector:
@nerdalert
nerdalert / Netfilter-IPTables-Diagrams.md
Last active November 13, 2024 13:26
Linux NetFilter, IP Tables and Conntrack Diagrams

Linux NetFilter, IP Tables and Conntrack Diagrams

IPTABLES TABLES and CHAINS

IPTables has the following 4 built-in tables.

1) Filter Table

Filter is default table for iptables. So, if you don’t define you own table, you’ll be using filter table. Iptables’s filter table has the following built-in chains.

@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active October 24, 2024 17:43
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@santa4nt
santa4nt / arp_scapy.py
Created February 28, 2013 19:23
Some quick-n-dirty sample code and functions to manipulate ARP packets (for network filter testing).
from scapy.all import *
# change this to your test machine's MAC address
SELF_MAC = '00:0c:29:67:22:c2'
BCAST_MAC = 'ff:ff:ff:ff:ff:ff'
# this will send a PROBE ARP request packet to the supplied IP address argument
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs