This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
# 获取 script 标签中的变量数据 ex: var abc = {data: {"actionModule": "abc"}}; | |
get_script_var_re = re.compile('var abc = (.*?};)?') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install with source | |
[[tool.poetry.source]] | |
name = "aliyun" | |
url = "https://mirrors.aliyun.com/pypi/simple" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dataclasses import dataclass | |
@dataclass | |
class LogInfo: | |
req: str | |
body: str | |
ua: str | |
def handle_line_by_re(line) -> LogInfo: | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 确认再 Python 虚拟环境下 | |
export PATH="/usr/local/Cellar/mysql@5.7/5.7.29/bin/:$PATH" # 将本机的 MySQL 路径加到 PATH | |
# 如果出现 ld: library not found for -lssl | |
# 但此问题已在 2020年2月被 mysqlclient在主分支修复,暂未发布 | |
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" | |
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include" | |
# 执行安装 | |
pip install mysqlclient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git fetch origin refs/pull/10/head:patch-2 | |
# 10 是 PR 对应的编号 | |
git checkout patch-2 | |
# 你的修改 | |
git add -u | |
git commit -m "描述你的修改" | |
git remote add LalZzy https://github.com/LalZzy/cosx.org.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
class Driver: | |
""" selenium web driver instance """ | |
def __init__(self): | |
self.chrome = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
comments = [] | |
comment_tasks = [] | |
# loop and add part one all tasks | |
for comment in comments: | |
comment_info = { | |
'id': comment.id, | |
'message': comment.message | |
} | |
comment_tasks.append(do_analyze.si(task_info, comment_info)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# show container's IP | |
sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container_id or container_name> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 批量删除远程分支 | |
git push origin --delete <branch1> <branch2> <branch3> | |
# 移除本地的无对应远程的分支 | |
git remote prune origin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run a simple mongo server | |
docker run --rm --name mymongo -p 27017:27017 -d mongo | |
# run mongo web | |
docker run --rm --name mymongo-express --link mymongo:mongo -p 8081:8081 -d mongo-express |
NewerOlder