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
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/
Opinion on Lua
power but poor, very host limited
SSH config in macOS Ventura
macOS Ventura changed SSH algorithm, you need to update your SSH config file ~/.ssh/config
to make it work.
Host *
UseKeychain yes
IdentitiesOnly yes
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa
10th
2012.09.29 -> 2022.09.29, I LOVE Linn