Skip to content

Instantly share code, notes, and snippets.

View NewpTone's full-sized avatar
🎯
Focusing

Newptone NewpTone

🎯
Focusing
View GitHub Profile
@NewpTone
NewpTone / gist:22c14937c0efa45d8cbbc0bdb0548e77
Created April 1, 2025 01:14
simple web app based on py3
# webapp.py
import json
from functools import cached_property
from http.cookies import SimpleCookie
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import parse_qsl, urlparse
class WebRequestHandler(BaseHTTPRequestHandler):
@cached_property
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 46 bits physical, 48 bits virtual
CPU(s): 80
On-line CPU(s) list: 0-79
Thread(s) per core: 2
Core(s) per socket: 20
Socket(s): 2
NUMA node(s): 2
# sar -dp 1|egrep 'sdk'
12:03:35 sdk 104.00 24008.00 0.00 230.85 1.08 8.85 6.15 64.00
12:03:36 sdk 81.00 12320.00 97.00 153.30 2.64 34.47 12.35 100.00
12:03:37 sdk 1420.00 12904.00 40301.00 37.47 4.89 3.46 0.57 81.60
12:03:38 sdk 105.00 24696.00 0.00 235.20 1.27 12.00 5.83 61.20
# dstat -df -D sdk
--dsk/sdk--
read writ
smartctl -a -d megaraid,15 /dev/sdf |egrep '(ID#|5|187|188|197|198) '
LU WWN Device Id: 5 000c50 078f17a55
Local Time is: Wed Feb 20 15:26:55 2019 NZDT
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail Always - 0
7 Seek_Error_Rate 0x000f 095 060 030 Pre-fail Always - 3658224270
187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0
188 Command_Timeout 0x0032 100 100 000 Old_age Always - 0
190 Airflow_Temperature_Cel 0x0022 072 066 045 Old_age Always - 28 (Min/Max 25/33)
195 Hardware_ECC_Recovered 0x001a 057 014 000 Old_age Always - 147384090
sar -s 06:00:00 -e 10:00:00 -dp|egrep 'util|sdf'
06:00:01 DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util
06:01:01 sdf 293.34 1401.13 7113.73 29.03 0.64 2.17 0.91 26.78
06:02:01 sdf 243.03 870.57 5665.16 26.89 0.74 3.02 1.37 33.40
06:03:01 sdf 278.69 456.51 10798.72 40.39 0.75 2.72 1.24 34.55
06:04:01 sdf 271.57 881.11 8042.70 32.86 0.64 2.35 1.01 27.33
06:05:01 sdf 285.17 1160.78 10769.99 41.84 0.76 2.66 1.18 33.67
06:06:01 sdf 297.62 1555.65 6814.88 28.12 1.57 5.27 2.27 67.63
06:07:01 sdf 256.02 714.41 6853.26 29.56 0.72 2.81 1.25 31.88
06:08:01 sdf 264.10 1028.61 6902.16 30.03 0.89 3.36 1.68 44.25
#!/bin/bash
CLOUDINIT='/var/log/cloud-init-complete.txt'
while true; do
if [ -f $CLOUDINIT ]; then
RES=`cat $CLOUDINIT`
if [ "$RES" == 'Complete' ];then
break
fi
tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes
14:34:22.261304 IP (tos 0x0, ttl 64, id 14446, offset 0, flags [DF], proto TCP (6), length 60)
198.11.183.116.59861 > 103.254.157.223.1723: Flags [S], cksum 0x838c (incorrect -> 0x5154), seq 3386271564, win 29200, options [mss 1460,sackOK,TS val 2154258210 ecr 0,nop,wscale 7], length 0
14:34:22.408503 IP (tos 0x0, ttl 49, id 0, offset 0, flags [DF], proto TCP (6), length 60)
103.254.157.223.1723 > 198.11.183.116.59861: Flags [S.], cksum 0x0e83 (correct), seq 2999524700, ack 3386271565, win 28960, options [mss 1460,sackOK,TS val 19690078 ecr 2154258210,nop,wscale 7], length 0
14:34:22.408568 IP (tos 0x0, ttl 64, id 14447, offset 0, flags [DF], proto TCP (6), length 52)
198.11.183.116.59861 > 103.254.157.223.1723: Flags [.], cksum 0x8384 (incorrect -> 0xad65), seq 1, ack 1, win 229, options [nop,nop,TS val 2154258247 ecr 19690078], length 0
14:34:22.409228 IP (tos 0x0, ttl 64, id 14448, offset 0, flags [DF], proto TC
############ 4.x  (Meltdown Patch)
# ab -n 10000 -c 100 https://xingchaoyu-dev-api1.openstacklocal:35357/v2.0
Server Software: nginx/1.12.2
Server Hostname: xingchaoyu-dev-api1.openstacklocal
Server Port: 35357
SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,4096,128
Document Path: /v2.0
Document Length: 363 bytes
@NewpTone
NewpTone / gist:8929199
Created February 11, 2014 04:18
rbd secret
if ($rbd_secret_uuid) {
nova_config {
'DEFAULT/rbd_secret_uuid': value => $rbd_secret_uuid
}
# If rbd_secret_uuid is set, then libvirt handles auth via a secret key
file {'secrets':
ensure => directory,
path => '/etc/libvirt/secrets',
mode => '0600',
owner => 'root',