cd error with CDAPTH
I’ve set $CDPATH
in zsh for quick directories switching. But this bring some issues with make
or npm run
:
/bin/sh: line 0: cd: src: No such file or directory
cd
wants to change some directory but uses $CDPATH
first to find. Add .
to $CDPATH
to fix this:
export CDPATH=.:$HOME/src
gnutls_handshake() failed: Error in the pull function
The error means that Git can’t establish a secure connection to the remote repository. Your version of Git uses the GnuTLS library to set up TLS (encrypted) connections, try building Git against a version of libcurl using OpenSSL.
sudo apt-get update
sudo apt-get install curl build-essential fakeroot dpkg-dev libcurl4-openssl-dev
sudo apt-get build-dep git
mkdir ~/git-openssl
cd ~/git-openssl
apt-get source git
cd git-2.17.1/
vim debain/control
# :%s/libcurl4-gnutls-dev/libcurl4-openssl-dev/g
vim debian/rules
# comment TEST =test to ignore test in building
sudo dpkg-buildpackage -rfakeroot -b -uc -us
sudo dpkg -i ../git_2.17.1-1ubuntu0.4_amd64.deb
Notes on 前端密码加密
https://blog.huli.tw/2023/01/10/security-of-encrypt-or-hash-password-in-client-side/
- HTTPS must
- 无加密的问题:
- 可能被 MITM 等方式看到明文密码,继而「撞库」等
- 可能被错误 logging 记录明文密码
- 加密可以规避上述问题
- hash 解决了被看到「明文密码」,避免被撞库,但弱 hash 可通过彩虹表得到明文密码
- hash 无法解决被直接使用,比如通过 MITM/logging 等拿到 hash 后可以直接访问
- 端侧 public key 加密,服务端 private key 解密,也是同样的问题
- SRP (Secure Remote Password protocol) 是更好的解决方案
- 或者 Passkeys
Shell file tests
List of common file test operators used in shell scripts:
-e file
: Check if file exists-f file
: Check if file exists and is a regular file-d file
: Check if file exists and is a directory-s file
: Check if file exists and has size greater than 0-r file
: Check if file exists and is readable-w file
: Check if file exists and is writable-x file
: Check if file exists and is executable-p file
: Check if file exists and is a named pipe (FIFO)
Check man test
for more and details.
How to know I'm using venv Python
Several ways to know if the Python interpreter is running inside a virtual environment:
- Solution 1: use
sys.prefix
that points to the Python directory - Solution 2 (the better way):
VIRTUAL_ENV
environment variable. When a virtual environment is activated, this is set to the venv’s directory, otherwise it’s None.
import os
print(os.environ.get('VIRTUAL_ENV'))
Special Characters in Bash
$0
: name of the script$1
to$9
, arguments to the script.$1
is the first argument and so on.$@
: all the arguments$#
: number of arguments$?
: return code of the previous command$$
: process identification number (PID) for the current script
FYI:
App broken on Silicon macOS
“App” can’t be opened. You should move it to the Trash
or
“App” 已损坏,无法打开。你应该将它移到废纸篓。
Solution:
sudo xattr -rd com.apple.quarantine /Applications/App.app
brew operation timed out
brew
error:
Operation timed out after 5000 milliseconds with 2740800 out of 3443379 bytes received
Slow internet connection will cause this error. export HOMEBREW_NO_INSTALL_FROM_API=1
to fix this, installing from API is the default behavior in brew 3.6.20.
[self review:2022];
C
- H 项目延期导致亏损,直接影响就是团队裁员
- 项目中间进行变更,痛苦的过程最后有点无厘头的结束,结论:不是所有人都认真关注你关注的,大差不差即可,时间会帮助你
- 和聪明但流程贪婪的人做生意,结果就是被吃干抹净
- 全年收获:团队,认可
Git Worktree Notes
git worktree
,不切换 git 分支,又在多个分支同时工作。
git worktree list
list all worktreegit worktree add [-b <new-branch>] <path> [<commit-ish>]
create a worktree at path and checkout commit-ish into itgit worktree remove <worktree>
remove the special worktreegit worktree prune
prune dirty infos