Logo Ricky
  • Home
  • About
  • More
    Skills Experiences Education Projects
  • Posts
  • Notes
  • Activities
  • Transform
  • English
    English Chinese
  • Dark Theme
    Light Theme Dark Theme System Theme
Logo Inverted Logo
  • Posts
  • 2017
  • 2018
  • 2019
  • 2020
  • 2021
  • 2022
  • 2023
  • 2024
  • 2025
  • 2026
  • /etc/shadow and Creating yescrypt, MD5, SHA-256, and SHA-512 Password Hashes
  • 15 Rules of Channels and Their Implementation
  • 5 DevSecOps open source projects to know
  • 6 YAML Features most programmers don't know
  • 6首國際最強公認催眠曲
  • [Community] Cisco UCS CIMC series
  • [Golang] Use build tags for different build configs
  • [Juniper Firewall] command
  • [Kubernetes] Service Overview
  • [Notes] Build an Ubuntu remote desktop environment on GCP
  • [Share] Keychain - Pendant from a Type 57 rifle bayonet scabbard
  • [Translated] Go inline strategy and limitations
  • A Brief Look at Go Iterators
  • A Concise Go embed Tutorial
  • A fast and powerful log viewer and processor that converts JSON logs or logfmt logs into a clear human-readable format.
  • A python script that allows your terminal to snow.
  • A10
  • Abount Ansible Hosts
  • Add SFTP user and share directory
  • Advanced macOS Command-Line Tools
  • Advanced Shell Scripting Techniques: Automating Complex Tasks with Bash
  • Aliyun CDN Cache Rules
  • An easy way to identify virtualization technology
  • An introduction to hacker tools: the tip of the iceberg
  • Ancient Time Units
  • Ansible Introduction
  • ansible.builtin.slurp - read file content
  • Applying HTTPS Certificates for CDN
  • Argo CD ApplicationSet Controller: The World Turns for Me!
  • Arp notes
  • Articles
  • Articles
  • Articles
  • Articles
  • Articles
  • Articles
  • Avalon (The Resistance: Avalon)
  • Avoiding the Top 10 NGINX Configuration Mistakes - NGINX
  • Back up databases with mydumper
  • Backup FortiOS config with Ansible - with RestAPI
  • Bash Bitwise Operators
  • Basic kubeadm usage notes (by request)
  • Best Practices for Writing Bash Scripts
  • Best V2Ray One-Click Install & Management Script
  • Bind JSON with jsoniter in Gin
  • BIRD and BGP: a beginner's kickoff
  • Black Hat Go
  • Build a Lightweight Docker Image for Your Go App? | IT Man
  • Build a Private Object Storage with Traefik v3 and MinIO in Docker
  • Bypass X-Frame-Options with Nginx
  • Cannot set command timeout per task with network_cli
  • Cloudflare Traffic sequence
  • Cloudflare Tunnel
  • Cloudflare Zero Trust
  • Common GitBook plugins
  • Common shell scripting tips
  • Configuring SSH Keys for Multiple GitHub Accounts
  • Container security fundamentals
  • Containers from scratch
  • Containers From Scratch by Golang (feat. Liz Rice)
  • Convert a List to a List of Dicts
  • Convert Cloudflare WARP to an HTTP Proxy
  • Convert Command Output to an Image
  • Convert your codebase into a single LLM prompt.
  • Create macOS DMG and Bootable ISO
  • CS Visualized: Useful Git Commands
  • Data Center Notes
  • Database Fundamentals
  • datavizproject
  • Day 19 BGP Protocol (1)
  • Day 28 - Introduction to Useful Third-Party Kubernetes Tools
  • Dedicated Server CPU Frequency Maximization Guide
  • Deploying OpenVPN with AD domain authentication
  • Do you understand the Nginx request processing flow?
  • Docker Containers Can't Access the Internet? NAT Configuration Guide for nftables
  • Docker Introduction
  • Docker Security Best Practices: Cheat Sheet
  • Docker Tips: Using Docker Config
  • docker-compose yaml problem
  • Dockertest: A Fast Way to Set Up Integration Test Environments
  • Draw Diagrams With Markdown
  • Elasticsearch Study Notes
  • Emoji Regular expression
  • Enable GitLab project integration: Mattermost slash commands
  • Everyone Needs an HTTP Proxy to Debug
  • Everything About MTU and MSS
  • Excessive Errors from `sentry.lang.javascript.processor: SoftTimeLimitExceeded()`
  • Expose your local web server to the internet with a public URL.
  • Faster Multi-Platform Builds: Dockerfile Cross-Compilation Guide
  • Fetch GraphQL schema information
  • Fighting DDoS: nginx, iptables, and fail2ban
  • Fighting ISP Cache Hijacking Again with iptables
  • Firewall Update
  • Fix Nginx 500 errors (too many open files, connection)
  • Fixing Disk Space Not Freed on Linux
  • Force file download with Nginx
  • Fortigate Management Interface in HA Mode
  • Getting Started with GitHub Actions
  • Gin documentation (Chinese)
  • Git force push
  • GitLab CI Can Automatically Check Code Quality! How to Use SonarQube for Code Quality Checks?
  • Gitlab-CI Introduction
  • Gluetun: Route Docker Containers Through a VPN, Disconnect on No Network
  • Go 1.21 GA PGO Optimization You Can't Grasp in One Read — A Try on WebP Server Go
  • Go AES Encryption and Decryption in Three Modes (CBC/ECB/CFB)
  • Go Articles
  • Go code refactoring : the 23x performance hunt
  • Go Generics Beginner Notes
  • Go High-Performance Programming Handbook (Long Read)
  • Go leetcode
  • Go Modules workflow for private Git repositories
  • Go Patterns
  • Go pprof in Practice
  • Go Practical Guide: Execute Lua Scripts with go-redis
  • Go Protobuf: The New Opaque API
  • Go string format
  • Go Style Decisions - Pass values
  • Go Tool Trace
  • go-mysql-elasticsearch-benchmarking
  • go-synctest
  • Golang benchmarks
  • Golang os/exec usage (notes)
  • Golang Service Exceeded File Handle Limit (too many open files)
  • Golang Tips
  • Google Cloud Platform(GCP): Access Linux Server using GUI running in GCP instance using Windows Remote Desktop Connection.
  • Google Infra
  • Google Search Operators: The Complete List (44 Advanced Operators)
  • GraphQL Introspection Query
  • HA command
  • Harden a Server with Fail2Ban + nftables
  • Hide Within Cloudflare's Global Network
  • High Performance Go Workshop
  • How Core Git Developers Configure Git
  • How Does Nginx Defend Against DDoS?
  • How Go Reads a 16GB File in 25 Seconds
  • How I configure my Git identities
  • How Nginx Hides Upstream Errors
  • How Terminals Work
  • How to automatically resize virtual box disk with vagrant
  • How to capture web pages and long screenshots with Chrome DevTools?
  • How to Choose a Go File Reading Approach
  • How to configure time zone and NTP on RHEL7/CentOS7
  • How to Create Temporary Files in Bash: mktemp and trap
  • How to deal with a 50GB large csv file in r language?
  • How to Delete Files With Names That Contain Non-printable Characters
  • How to deploy on remote Docker hosts with docker-compose
  • How to Detect RAID Information in Linux
  • How to Enable SNMP on a Switch
  • How to Install Fedora Linux on Surface Go 2 to Boost Entry-Level Tablet Performance
  • How to Make an iPhone Ringtone: Turn an MP3 into a Ringtone or Alarm
  • How to Make Output Overwrite the Same Line in a Terminal
  • How to use a here documents to write data to a file in bash script
  • How to Use which on an Aliased Command
  • htop explained
  • I can feel the speed — optimize zsh and oh my zsh cold start
  • I Replaced Redis with PostgreSQL (And It's Faster)
  • I use Zip Bombs to Protect my Server
  • Illustrating How Data Alignment Affects Memory Usage in Go
  • In 2020, use the latest NGINX ngx_http_geoip2 module to block IPs by country or region
  • Inspecting Web Views in macOS
  • Install Chrome OS
  • Install Font Libraries and Chinese Fonts on Linux CentOS 7
  • Install PowerDNS and PowerDNS-Admin on Ubuntu 22.04|20.04|18.04
  • Introduction to Git internals
  • Is there a regular expression to detect a valid regular expression?
  • iTerm2 features I find useful
  • Jinja docx template, avoiding new line in nested for
  • Juniper notes
  • Kubernetes Runtime Explained in Plain Language
  • Kubernetes Without kube-proxy
  • Let Zsh read macOS system proxy settings and set env vars
  • Lightweight Linux Distributions For Older PCs
  • Linkerd 2.8 - Build a Simple and Secure Multi-Cluster Kubernetes Architecture
  • Links
  • Little Git Tricks: Use .mailmap to Merge Different Authors
  • llamafile - Distribute and run LLMs with a single file.
  • LLM Visualization
  • LLMs Hackmd Docs
  • Load Balancing with iptables and ip rule
  • Local LLM on MacBookPro
  • Local LLM on MacBookPro - Image
  • LocalStorage vs. IndexedDB vs. Cookies vs. OPFS vs. WASM-SQLite
  • LVM - lvg and lvol
  • Mac Niche App Recommendations and Workflow Share (2024)
  • macOS Tips & Tricks
  • Makefiles for Web Projects: Manage Your Environment Workflow
  • Marp教學:Markdown搭配VS Code做簡報,快速輸出為PPTX或PDF,提昇做簡報效率
  • Misspelling, missing collection, or incorrect module path for fortios_system_config_backup_restore
  • Monitoring HTTP Requests on a Network Interface in Real Time
  • More Powerful Go Execution Tracing
  • Mosdns-X
  • Mount a Synology NAS folder on CentOS 7
  • Mount AWS S3 Bucket On Amazon EC2
  • My Productivity Mac Settings and Apps
  • Netcat (Linux nc) Practical Examples for Network Admins
  • New LibSSH Connection Plugin for Ansible Network Replaces Paramiko, Adds FIPS Mode Enablement
  • Nginx HTTPS with Basic Auth reverse proxy for VMware ESXi 6.5 fixed VMRC /screen
  • Nginx if 避坑指南
  • NGINX Native ACME Support: Rethinking TLS Automation from the Ground Up
  • Nginx notes
  • Nginx request_time and upstream_response_time explained
  • Nginx SSL/TLS configuration with TLSv1.2 and TLSv1.3 - ECDHE and strong ciphers suite (Openssl 1.1.1)
  • nginx 添加第三方nginx_upstream_check_module 模块实现健康状态检测
  • Objective-See: An Open Source Project Org for Apple Privacy and Security
  • OIDC(OpenID Connect) 简介
  • On High Availability Systems
  • onion-mirror
  • OpenResty + Redis: Block High-Frequency IPs
  • parqeye
  • Parse Command Line Arguments in Bash
  • Percona config
  • Pitfalls When Parsing Binary Data in Go
  • Pokemon Legends: Arceus - Two Playthroughs Completed
  • Printing ASCII Art in the Shell
  • Privacy Badger: A Free EFF Browser Extension to Block Online Tracking
  • Prometheus relabeling and linux metrics
  • Provisioning a Windows Server Vagrant box with IIS, .NET 4.5 and Octopus Deploy
  • Python install module issues
  • Python Numbers Every Programmer Should Know
  • Python Telegram Bot
  • Python's many command-line utilities
  • Quagga Routing - Install, Configure and setup BGP
  • RAID10 Total Failure: Mirror Drives in the Same Group Failed Together
  • Rainman Engineering Culture: Eight Interview Questions to Spot Excellence
  • Record Millisecond Precision in Nginx Access Logs
  • Reduce the Chance of Home Web Services Being Reported
  • Regex for Markdown Syntax
  • Relay V2Ray Traffic via Cloudflare
  • Replace Watchtower with WUD: Build a Controlled Docker Auto-Update Plan
  • Representative HTTP Status Codes
  • Route notes
  • Rules that terminal programs follow
  • Run llama3
  • Running GitHub Actions for Certain Commit Messages
  • Rust Easy! Modern Cross-platform Command Line Tools to Supercharge Your Terminal
  • Selectively Disabling HTTP/1.0 and HTTP/1.1
  • Sentry Source Code Development Notes
  • Set interface IP with netplan on Ubuntu 18.04
  • Set SSLKEYLOGFILE on MacBook to decrypt HTTPS traffic
  • Setting up JWT Authentication
  • Sharpen the Axe Before Cutting Wood: My Home Network Setup
  • Shell Script Best Practices
  • Shell Script Study Notes
  • Sign git commits with GPG
  • Simple A/B Testing with Nginx split_clients
  • Simulate Network Anomalies with TC and Netem
  • Smarter than 'Ctrl+F': Linking Directly to Web Page Content
  • Some Jenkinsfile examples
  • Some Software Design Principles
  • Speeding up the Rust edit-build-run cycle
  • SQL Join types explained visually
  • SQL queries don't start with SELECT
  • SSH certificate login guide
  • SSH failing with Error : fatal: daemon() failed: No such device
  • string field was converted to True (type string)
  • Struct Tricks Every Gopher Should Know
  • Style PowerShell with oh-my-posh
  • Super easy! Build a beautiful and handy zsh terminal
  • Supply chain attack
  • Surprisingly, you can view images in the Linux CLI?
  • Switch Firmware Update
  • Switch notes
  • Synology: Your NAS RAM Details at a Glance
  • Systemd Tutorial: Practical Part
  • Taide - training data
  • TaigiTube - Taiwanese Hokkien YouTube
  • Taiwanese Minnan Input Method App Launched: Mobile Devices Can Now Type Taiwanese
  • Take Screenshots with Selenium in Go
  • Tcpdump Usage Summary
  • Terraform Getting Started Notes
  • Terraform Provider Development Notes
  • Test Whether a Server Is Vulnerable to Shellshock Bug
  • The Art of Command Line
  • The One Billion Row Challenge in Go: from 1m45s to 3.4s in nine solutions
  • TIL: timeout in Bash scripts
  • Tools
  • Top 25 Nginx Tips and Tricks From Practical Experience
  • Tracking SQLite Database Changes in Git
  • Trellis Ansible Bad Interpreter Error
  • Tuning EMQX to Scale to One Million Concurrent Connection on Kubernetes
  • Tuning EMQX to Scale to One Million Concurrent Connection on Kubernetes
  • Uncle Joe teaches Elastic - 30 - Elasticsearch optimization tips (4/4) - Shard optimization management
  • Understand the crypto trio: Encode, Encrypt, and Hash
  • Understanding Cilium Series (1): Introduction to Cilium
  • Upgrade database failed after ugrade to Zabbix 5...
  • Use Go Fuzzing to Write More Complete Unit Tests
  • Use LinuxServer.io Docker Images to Turn Desktop Apps into Web Apps
  • Use Nginx and mod_pagespeed to Convert Images to WebP on the Fly
  • Use terminal and SSH to remote host
  • Using Python for multimedia: video, audio, and images
  • Using Vagrant to Deploy Multiple VMs on vSphere
  • Using Vim as a Diff Tool
  • Vagrantfile and Provider
  • vagrant筆記
  • Vim Tips - Edit Remote Files With Vim On Linux
  • vimrc Configuration Guide
  • VSCode Integration with DevSpace for Debugging!
  • WebP Cloud uses Cloudflare Workers to fetch content from the origin server in order to protect the origin server and start providing origin fetch time information.
  • What does `< <(command args)` mean in the shell?
  • What Happened To WebAssembly
  • What happens after you type a URL in the browser and press Enter?
  • What is the SHA256 that comes on the sshd entry in auth.log?
  • What the f*ck Python! 🐍
  • What to Do With Long Strings in YAML?
  • Why are QR Codes with capital letters smaller than QR codes with lower-case letters?
  • Why do browser user-agent strings always include Mozilla/5.0?
  • Why is this running?
  • Windows SSH Setup
  • WSL 2 .wslconfig configuration explained
  • Yongling Foundation AI Forum: How AI Shapes the Future of Humanity
  • Zsh Config Files and Priority
  • Zsh tab-completion not working
  • 一張圖學會【拼音輸入法】
  • 朋友旅行防止絕交檢查表
  • 設定 Haproxy 以防止 DDOS 攻擊
Hero Image
LVM - lvg and lvol

LVM - lvg and lvol volume group - name: 在 /dev/sda1 跟 /dev/sdb1 之上建立 volume group,其 extend size 設置為 32MB community.general.lvg: vg: vg.services pvs: /dev/sda1,/dev/sdb1 pesize: 32 local volume - name: 建立一個大小為 512m 的 local volume community.general.lvol: vg: firefly lv: test size: 512 Example --- - name: Create LVM for DRBD hosts: all become: yes vars: vg_name: drbdpool tasks: - name: Create a new primary partition for LVM community.general.parted: device: /dev/sdb number: 1 align: optimal flags: [lvm] state: present - name: Create a volume group on top of /dev/sda1 with physical extent size = 32MB community.general.lvg: vg: "{{ vg_name }}" pvs: /dev/sdb1 state: present - name: Create a logical volume community.general.lvol: vg: "{{ vg_name }}" lv: drbddata size: 100%FREE

Monday, September 5, 2022 Read
Hero Image
What to Do With Long Strings in YAML?

What to Do With Long Strings in YAML? YAML already defines this. In this case, there are four methods: |: Newlines under it are preserved as newlines, and the last line ends with a newline. >: Newlines under it are folded into spaces, forming a long string, and the last line ends with a newline. |-: Newlines under it are preserved, but the last line does not end with a newline. >-: Newlines under it are folded into spaces, and the last line does not end with a newline. In short, > and >- improve YAML readability without adding extra newline characters. | and |- keep the string exactly as defined: if you see a newline in YAML, the string contains a newline.

Monday, August 29, 2022 Read
Hero Image
Top 25 Nginx Tips and Tricks From Practical Experience

Top 25 Nginx Tips and Tricks From Practical Experience server_tokens off; ssl_protocols TLSv1.2 TLSv1.3; Disable any undesirable HTTP methods location / { limit_except GET HEAD POST { deny all; } } Enable sysctl based protection net.ipv4.conf.all.rp_filter = 1 net.ipv4.tcp_syncookies = 1 Stop image hotlinking location /images/ { valid_referers none blocked www.domain.com domain.com; if ($invalid_referer) { return 403; } } add_header X-Content-Type-Options nosniff; add_header X-XSS-Protection "1; mode=block"; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;

Wednesday, August 10, 2022 Read
Hero Image
Build a Lightweight Docker Image for Your Go App? | IT Man

Build a Lightweight Docker Image for Your Go App? | IT Man go build # default $ go build -o test1 main.go $ du -sh test1 14M test1 # You can add `-ldflags "-s -w"` during compilation to reduce the binary size by stripping some link and debug info. Details: # -a: force rebuilding all dependencies # -s: drop symbol table info; stack traces in panic will lose file/line info # -w: drop DWARF debug info; you cannot debug with gdb # If you don't need the symbol table, you can just use "-s" # Note: it is not recommended to use -w and -s together $ go build -ldflags "-s -w" -o test2 main.go $ du -sh test2 11M test2 upx(brew/yum install upx) $ upx test2 Ultimate Packer for eXecutables Copyright (C) 1996 - 2020 UPX 3.96 Markus Oberhumer, Laszlo Molnar & John Reiser Jan 23rd 2020 File size Ratio Format Name -------------------- ------ ----------- ----------- 11490768 -> 4063248 35.36% macho/amd64 test2 Packed 1 file. $ upx --brute test2 $ du -sh test2 4.6M test2 UPX compression options

Monday, July 25, 2022 Read
Hero Image
[Golang] Use build tags for different build configs

[Golang] Use build tags for different build configs Go build -ldflags package main import ( "fmt" ) var flagString string func main() { fmt.Println("This build with ldflag:", flagString) } $ go build -ldflags '-X main.flagString "test"' $ ./main This build with ldflag: test Go build -tags debug_config.go //+build debug package main var TestString string = "test debug" var TestString2 string = " and it will run every module with debug tag." func GetConfigString() string { return "it is debug....." } //+build debug needs a blank line before and after it (unless it is on the first line). release_config.go //+build !debug package main var TestString string = "test release" var TestString2 string = " and it will run every module as no debug tag." func GetConfigString() string { return "it is release....." } main package main import ( "fmt" ) func main() { fmt.Println("This build is ", TestString, TestString2, GetConfigString()) } $ go build -tags debug . $ ./main This build is test debug and it will run every module with debug tag. it is debug..... $ go build . $ ./main This build is test release and it will run every module as no debug tag. it is release.....

Monday, July 18, 2022 Read
Hero Image
A Concise Go embed Tutorial

A Concise Go embed Tutorial Embedding For a single file, you can embed it as string or []byte For multiple files and directories, you can embed them as a new filesystem (FS) Import the “embed” package even if it is not explicitly used The go:embed directive is used for embedding and must be followed by the target variable name Only string, []byte, and embed.FS are supported. Aliases and named types (e.g., type S string) are not allowed Uses relative paths string/[]byte package main import ( _ "embed" "fmt" ) //go:embed hello.txt var s string //go:embed hello.txt var b []byte func main() { fmt.Println(s) fmt.Println(b) } embed.FS package main import ( "embed" "fmt" ) //go:embed hello.txt hello2.txt //go:embed "p/he llo.txt" //go:embed `p/hello-2.txt` //go:embed dir var f embed.FS func main() { data, _ := f.ReadFile("hello.txt") fmt.Println(string(data)) data, _ = f.ReadFile("hello2.txt") fmt.Println(string(data)) data, _ := f.ReadFile("p/he llo.txt") fmt.Println(string(data)) data, _ = f.ReadFile("p/hello-2.txt") fmt.Println(string(data)) } Matching patterns go:embed can take just a directory name. All files and directories inside, except those starting with . and _, are embedded. Subdirectories are embedded recursively to form a filesystem for that directory.

Tuesday, July 12, 2022 Read
Hero Image
Using Vim as a Diff Tool

Using Vim as a Diff Tool command vim -d file1.txt file2.txt or vimdiff file1.txt file2.txt Switching Between Diff Windows: Ctrl-w + Ctrl-w Changing Split Window Orientation ctrl-w + K key combination to change window orientation from vertical to horizontal. ctrl-w + H shortcut to switch back window orientation to a vertical split. Jumping Between Changes ]c key combination to go to the next change. [c shortcut to jump to the previous change. Applying Changes From the Diff Window: :diffget, :diffput Export Diff to the HTML Web Page: :TOhtml | w ~/diff.html

Thursday, July 7, 2022 Read
Hero Image
OIDC(OpenID Connect) 简介

OIDC(OpenID Connect) 简介 Authentication vs. authorization Authentication 通常是指校验是否是用户本人的这个过程,而 Authorization 则更多的是指用户是否有权限。通常我们都是先校验 是否是用户本人,然后再校验用户是否有权限。也就是先开始 Authentication,再开始 Authorization。 Authentication Authorization Determines whether users are who they claim to be Determines what users can and cannot access Challenges the user to validate credentials (for example, through passwords, answers to security questions, or facial recognition) Verifies whether access is allowed through policies and rules Usually done before authorization Usually done after successful authentication Generally, transmits info through an ID Token Generally, transmits info through an Access Token Generally governed by the OpenID Connect (OIDC) protocol Generally governed by the OAuth 2.0 framework Example: Employees in a company are required to authenticate through the network before accessing their company email Example: After an employee successfully authenticates, the system determines what information the employees are allowed to access OAuth 2 Client Credentials Grant 这种模式是最简单的,其实就是客户端告诉服务端自己是哪个客户端,服务器就将 access_token 下发

Wednesday, July 6, 2022 Read
Hero Image
Bash Bitwise Operators

Bash Bitwise Operators Bash’s Tools for Base Conversion Bash’s arithmetic expansion allows us to write numbers in any base by prefixing the numeric digits of the base followed by the hash symbol. $ echo $((2#1001)) 9 bc allows us to convert effortlessly between bases, using the parameters ibase (for the input base) and obase (for the output base). So, let’s convert the decimal number 9 to base 2 $ echo "ibase=10;obase=2;9" | bc 1001

Monday, July 4, 2022 Read
Hero Image
Simple A/B Testing with Nginx split_clients

Simple A/B Testing with Nginx split_clients ngx_http_split_clients_module Configure For example, suppose we want 20% of users to be redirected to https://example.com/, 30% to https://example.org/, and the rest to https://example.edu/. split_clients "${remote_addr}AAA" $variant { 20% https://example.com/; 30% https://example.org/; * https://example.edu/; } server { listen 80; listen [::]:80; server_name _; return 302 ${variant}; } In the example above, the visitor’s IP address plus the string AAA is hashed with MurmurHash2 into a number. If the number falls in the first 20%, $variant is https://example.com/. If it falls in the middle 30%, $variant is https://example.org/. Otherwise it is https://example.edu/.

Monday, July 4, 2022 Read
Hero Image
Monitoring HTTP Requests on a Network Interface in Real Time

Monitoring HTTP Requests on a Network Interface in Real Time tcpflow apt/dnf install tcpflow $ sudo tcpflow -p -c -i wlp0s20f3 port 80 | grep -oE '(GET|POST) .* HTTP/1.[01]|Host: .*' reportfilename: ./report.xml tcpflow: listening on wlp0s20f3 GET /alexlarsson/flatpak/ubuntu/dists/focal/InRelease HTTP/1.1 GET /mirrors.txt HTTP/1.1 -p disables promiscuous mode -c means only print the output to the console and don’t create files -i specifies the network interface grep receives the output of tcpflow -o means show only the matching parts of the lines that match the pattern -E means the pattern is an extended regular expression (ERE) httpry https://github.com/jbittel/httpry.git

Thursday, June 23, 2022 Read
Hero Image
Go pprof in Practice

Go pprof in Practice Bomb program package main import ( // omitted _ "net/http/pprof" // auto-register handlers to the HTTP server for profiling via HTTP // omitted ) func main() { // omitted runtime.GOMAXPROCS(1) // limit CPU usage to avoid overload runtime.SetMutexProfileFraction(1) // enable lock contention profiling runtime.SetBlockProfileRate(1) // enable blocking operation profiling go func() { // start an HTTP server; pprof handlers have already been registered // /debug/pprof/ if err := http.ListenAndServe(":6060", nil); err != nil { log.Fatal(err) } os.Exit(0) }() // omitted } http://localhost:6060/debug/pprof/ Type Description Notes allocs Samples of memory allocations Can open in a browser, but readability is low blocks Samples of blocking operations Can open in a browser, but readability is low cmdline Show program startup command/args Can open in a browser; shows ./go-pprof-practice goroutine Stacks of all current goroutines Can open in a browser, but readability is low heap Samples of heap memory usage Can open in a browser, but readability is low mutex Samples of lock contention Can open in a browser, but readability is low profile Samples of CPU usage Opening in a browser downloads a file threadcreate Samples of system thread creation Can open in a browser, but readability is low trace Program execution traces Opening in a browser downloads a file; not covered here, see Go trace Investigate high CPU usage

Wednesday, June 22, 2022 Read
  • ««
  • «
  • 11
  • 12
  • 13
  • 14
  • 15
  • »
  • »»
Navigation
  • About
  • Skills
  • Experiences
  • Education
  • Projects
Contact me:
  • zeyanlin@outlook.com
  • linzeyan
  • Ricky
  • Ricky