Skip to content

Instantly share code, notes, and snippets.

View tangnotes's full-sized avatar

James Tang tangnotes

View GitHub Profile
@tangnotes
tangnotes / cpupower.txt
Created February 20, 2022 16:48
cpupower
root@devpc01:/home/linhua# cpupower frequency-info
analyzing CPU 0:
driver: intel_cpufreq
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 20.0 us
hardware limits: 800 MHz - 3.40 GHz
available cpufreq governors: conservative ondemand userspace powersave performance schedutil
current policy: frequency should be within 800 MHz and 3.40 GHz.
The governor "ondemand" may decide which speed to use
@tangnotes
tangnotes / dmesg
Created February 20, 2022 14:57
Trafgen exhausted system resources (CPU, memory, and NIC?)
[Sun Feb 20 14:50:58 2022] rcu: INFO: rcu_sched self-detected stall on CPU
[Sun Feb 20 14:50:58 2022] rcu: 0-...!: (1 GPs behind) idle=ab6/1/0x4000000000000002 softirq=71528/71530 fqs=0
[Sun Feb 20 14:50:58 2022] (t=403679 jiffies g=325261 q=466)
[Sun Feb 20 14:50:58 2022] rcu: rcu_sched kthread starved for 403679 jiffies! g325261 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x0 ->cpu=1
[Sun Feb 20 14:50:58 2022] rcu: Unless rcu_sched kthread gets sufficient CPU time, OOM is now expected behavior.
[Sun Feb 20 14:50:58 2022] rcu: RCU grace-period kthread stack dump:
[Sun Feb 20 14:50:58 2022] task:rcu_sched state:I stack: 0 pid: 12 ppid: 2 flags:0x80004000
[Sun Feb 20 14:50:58 2022] Call Trace:
[Sun Feb 20 14:50:58 2022] __schedule+0x2d1/0x830
[Sun Feb 20 14:50:58 2022] schedule+0x35/0xa0
@tangnotes
tangnotes / netstat-without-netstat.md
Created October 27, 2021 14:59
netstat without netstat
function getPPID() {
_pid0=$1
_pid=`ps --no-header -o pid -p $_pid0`
if [ "x$_pid" == "x" ]
then
echo "Error: $_pid0 does not exists"
return
fi
echo -n "$_pid > "
import redis
import random
import string
import threading
host_ip='192.168.0.100'
host_port=6379
target_size = 1024 * 1024 # KB
def get_random_string(length):
@tangnotes
tangnotes / pngpaste.sh
Created July 18, 2018 09:46
pngpage for Ubuntu
#!/bin/bash
file=$1
if [ "x$file" == "x" ]
then
echo "Usage: $0 FILE_NAME"
exit 1
fi
@tangnotes
tangnotes / nginx.service
Created July 12, 2018 10:06
Nginx Systemd: /lib/systemd/system/nginx.service
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
@tangnotes
tangnotes / iterm2-default-config-2.json
Last active April 24, 2018 14:28
iTerm2 Configuration
{
"Ansi 6 Color" : {
"Green Component" : "0.5960785",
"Blue Component" : "0.6039215999999999",
"Red Component" : "0.02352941"
},
"Tags" : [
],
"Ansi 12 Color" : {
@tangnotes
tangnotes / _bash_profile
Last active July 5, 2018 15:00
Mac Bash Profile
export TANGO_ENV=personal_laptop
export PS1="[\033[32m\d \t\033[0m] \h: \033[36m\w\033[0m $\n> "
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
export PATH=/usr/local/bin:$PATH
@tangnotes
tangnotes / demo-upstream-nginx.conf
Created January 6, 2018 11:03
UVE Core deploy log
server {
listen 80;
server_name upstream.test.uve.io;
default_type 'application/json';
location / {
content_by_lua_block {
ngx.say('{"data":[{"uid":"123456","name":"James"}],"__tmeta":{"mkey1":"mval1","mkey2":"mval2"}}')
}
}
}