Skip to content

Instantly share code, notes, and snippets.

View JaySon-Huang's full-sized avatar
🤔

JaySon JaySon-Huang

🤔
  • PingCAP
  • CN
View GitHub Profile
@JaySon-Huang
JaySon-Huang / inode_usage.py
Created June 27, 2023 09:05
Collect the inode usage of given directory
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
class UsageInfo(object):
def __init__(self, inode_used, bytes_used):
self.inode = inode_used
@JaySon-Huang
JaySon-Huang / check_tiflash_alive.sh
Created December 12, 2022 08:17
A helper script to workaround hanging tiflash instance
#!/bin/bash
# set -x
DOC="A tiflash alive detect helper script.\
If tiflash is hanging, it receives the packets but doesn't respond. \
Dropping the packets will slow down the queries caused by the tidb \
alive detecting mechanism. \
This script checks the status port to detect whether TiFlash is hanging. \
Add a rule to iptables to REJECT the TCP packets once tiflash is hanging, \
@JaySon-Huang
JaySon-Huang / check_grafana.py
Last active September 13, 2023 06:55
Validate the correctness of the Grafana JSON model
#!/usr/bin/env python3
import sys
import json
import logging
def main():
logging.basicConfig(format='%(asctime)s [%(levelname)s] %(message)s', datefmt='%Y/%m/%d %H:%M:%S', level=logging.INFO)
if len(sys.argv) < 2:
logging.error("Usage: {} path/to/grafana.json".format(sys.argv[0]))
@JaySon-Huang
JaySon-Huang / pstack_helper.py
Last active April 14, 2023 05:54
A helper for grouping stacks of pstack output
#!/usr/bin/env python3
from concurrent.futures import thread
from random import sample
import re
import hashlib
from pprint import pprint
import sys
import unittest
class Frame:
@JaySon-Huang
JaySon-Huang / clean_tiup_patch_caches.py
Last active January 9, 2024 07:12
Clean up the stale patch packages from TiUP
#!/usr/bin/env python3
from __future__ import print_function
__doc__ = """
Put it to the machine deploy TiUP and add it to the crontab.
e.g.
> crontab -e
# clean up the patch caches for TiUP every day
@JaySon-Huang
JaySon-Huang / .vimrc
Last active April 11, 2023 06:40
My own oh-my-zsh
""""" 文件编码
set fileencodings=utf-8,gbk,gb2312
set termencoding=utf-8
set encoding=utf-8
"""""" 缩进相关
set ts=4 " tabstop 设置tab为4个空格
set sw=4 " shiftwidth 每层缩进4个空格
set expandtab " 输入的tab自动展开为空格. 设置后, 输入TAB, 需要Ctrl-V<TAB>
set softtabstop=4
"set smarttab
tap "adoptopenjdk/openjdk"
tap "grpc/grpc"
tap "homebrew/bundle"
tap "homebrew/cask", "https://mirrors.ustc.edu.cn/homebrew-cask.git"
tap "homebrew/core", "https://mirrors.ustc.edu.cn/homebrew-core.git"
tap "homebrew/services"
brew "autoconf"
brew "automake"
brew "bloaty"
brew "boost"
@JaySon-Huang
JaySon-Huang / CodeLLDB_CentOS.md
Last active December 14, 2023 18:23
Get VSCode CodeLLDB plugin work on CentOS 7

I want to debug with CodeLLDB on CentOS 7, but get an error like this:

/home/xxx/.vscode/extensions/vadimcn.vscode-lldb-1.6.1/adapter/codelldb: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /home/xxx/.vscode/extensions/vadimcn.vscode-lldb-1.6.1/adapter/codelldb)

LLDB requires a higher version of glibc.

I get it work by the following steps:

@JaySon-Huang
JaySon-Huang / calc_pg_in_osd.py
Created August 28, 2018 06:18 — forked from hnuzhoulin/calc_pg_in_osd.py
calculate the the distribution of pg in OSD
#!/usr/bin/env python
import sys
import os
import json
cmd = '''
ceph pg dump | awk ' /^pg_stat/ { col=1; while($col!="up") {col++}; col++ } /^[0-9a-f]+\.[0-9a-f]+/ {print $1,$col}'
'''
body = os.popen(cmd).read()
SUM = {}
for line in body.split('\n'):
@JaySon-Huang
JaySon-Huang / git.md
Last active August 29, 2015 14:07 — forked from suziewong/git.md

github的多人协作

  1. github上你可以用别人的现成的代码 直接 git clone 即可了

  2. 然后你也想改代码或者贡献代码咋办?

Fork