Skip to content

Instantly share code, notes, and snippets.

yum install centos-release-scl
yum install devtoolset-8-gcc*
scl enable devtoolset-8 bash
source /opt/rh/devtoolset-8/enable
  1. ps -eaf | grep process_name # get pid
  2. gcore $pid
  3. you got a $pid.core file.
@alvendarthy
alvendarthy / find-futex-wait.sh
Created September 7, 2022 05:47 — forked from amr/find-futex-wait.sh
Find processes executing futex with FUTEX_WAIT (helps find deadlock-ed processes)
#!/bin/bash
#
# Find all processes that are executing a futex(2) call with op=FUTEX_WAIT
# In some cases this can be helpful in finding deadlock-ed processes.
#
test ! $UID -eq 0 && echo -e "WARNING: Not running as root, only processes for this user are being scanned\n" >&2;
pids=$(ps -u $UID -opid --no-headers)
for pid in $pids; do
echo "your name" | sort -u | while read name; do echo -en "$name\t"; git log --after="start_date" --author="$name" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2; files[$3] } END { printf "added lines: %s, removed lines: %s, total lines: %s, total files: %s\n", add, subs, loc, length(files) }' -; done
git config --global credential.helper store
  1. type these 2 cmds in terminal windows.
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct
  1. reopen vscode, create a go project, then vscode auto pop up requesting for go extension installing.
  2. select install all
class myClassMethod():
    def __init__(self,func):
        self._func = func
    def __get__(self, obj, obj_type = None):
        def wrapper(*args,**kargs):
            return self._func(obj_type, *args, **kargs)

        return wrapper
# define our own classmethod decorator
class myClassMethod():
    # init a Decorator obj, see the Decorator protocol here: https://docs.python.org/3/glossary.html#term-descriptor
    def __init__(self,func):
        self._func = func
    
    # Decorator obj as an attibute, this method handlers the getattr call.
    def __get__(self, obj, obj_type = None):
 # warp the original function
@alvendarthy
alvendarthy / open_2_more_instances_of_wechat_app.md
Created April 16, 2022 08:06
open 2 more instances of Wechat app
nohup /Applications/WeChat.app/Contents/MacOS/WeChat > /dev/null 2>&1 &
# copy as many lines as instances you want to open.
nohup /Applications/WeChat.app/Contents/MacOS/WeChat > /dev/null 2>&1 &