usefully cmd
1 minute read ∼ Filed in : practisePython: pip without sudo
install
pip install --user some_pkg
export
note: check if the path exists; if not, check if pyhton3.6 is the correct folder name
export PYTHONPATH=$(python -c "import site, os; print(os.path.join(site.USER_BASE, 'lib', 'python3.6', 'site-packages'))"):$PYTHONPATH
run
python ...
Git
Git repo contribution 不见了
查看commit log中的邮箱
git log
git config --global user.email 'email address'
删除了在恢复
git reset HEAD file
git checkout -- file
删除文件
git rm --cached file
扔掉本地文件,强行同步远程分支
git reset --hard upstream/master
Git 克隆一个pr
git fetch origin refs/pull/PR_NUMBER/head:NEW_LOCAL_BRANCH
eg:
git fetch origin pull/611/head:pull_611
git checkout pull_611
Git submodule
Git submodule 添加后删了.gitsubmoduel, 导致无法再添加。
rm -rf .git/modules
git rm --cached path_to_modules
然后运行
git submodule add https://github.com:meltwater/served.git third_party/served
Linux cmds
查询文件或文件夹大小
//文件大小
du -sh * | sort -n
// 文件夹大小
du -lh --max-depth=1
查询cpu利用
top -bn 1 -i -c
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head