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.prefixthat points to the Python directory - Solution 2 (the better way):
VIRTUAL_ENVenvironment 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$1to$9, arguments to the script.$1is 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 listlist 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 pruneprune dirty infos
在功能开发 feature/x 过程中,突发紧急问题修复,通常可以通过 git stash 来临时保存当前修改,但这种方式容易造成混乱,推荐使用 git worktree,更为清晰:
# 从 master 分支创建一个临时工作区用于 hotfix
$ git worktree add -b emergency-fix ../temp master
$ pushd ../temp
# ... hack hack hack ...
$ git commit -a -m 'emergency fix for boss'
$ popd
$ git worktree remove ../temp
AI Vibe Coding 场景,可以通过 worktree 创建多个不同工作区,使用 Claude Code/Gemini CLI/OpenAI Codex/AMP 等多个工具进行,或者自己在主工作区进行 tasks 安排,创建 A 工作区做 task1,B 工作区做 task2。
Not allowed to navigate top frame to data URL
function base64ToArrayBuffer(_base64Str) {
var binaryString = window.atob(_base64Str);
var binaryLen = binaryString.length;
var bytes = new Uint8Array(binaryLen);
for (var i = 0; i < binaryLen; i++) {
var ascii = binaryString.charCodeAt(i);
bytes[i] = ascii;
}
return bytes;
}
function showDocument(_base64Str, _contentType) {
var byte = base64ToArrayBuffer(_base64Str);
var blob = new Blob([byte], {type: _contentType});
document.location.replace(URL.createObjectURL(blob));
}
showDocument('PGh0bWw+Cgo8Ym9keT4KICBoZWxsbyB3b3JsZC4KPC9ib2R5PgoKPC9odG1sPgo=', 'text/html');
- https://itechowl.wordpress.com/2020/01/27/javascript-not-allowed-to-navigate-top-frame-to-data-url-chrome/