sudo adduser tonytan
chmod -R 640 /etc/sudoers
sudo vim /etc/sudoers
chmod -R 440 /etc/sudoers
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 loguru_logger | |
logger = loguru_logger.get_logger() |
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
""" Snippet that demonstrates how to use Gunicorn with Uvicorn workers in code. | |
Feel free to run: | |
- `python main.py` - to use uvicorn. | |
- `ENV=prod python main.py` - to use gunicorn with uvicorn workers. | |
Reference: https://docs.gunicorn.org/en/stable/custom.html | |
""" |
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 logging | |
import gunicorn.app.base | |
from fastapi import FastAPI | |
from loguru import logger | |
class InterceptHandler(logging.StreamHandler): | |
def emit(self, record): | |
# Get corresponding Loguru level if it exists |
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
# -*- coding: utf-8 -*- | |
# 14-8-20 | |
# create by: snower | |
import os | |
import time | |
import struct | |
import fcntl | |
from logging.handlers import RotatingFileHandler, TimedRotatingFileHandler |
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
pipeline: | |
restore-cache: | |
image: drillster/drone-volume-cache | |
restore: true | |
ttl: 7 | |
mount: | |
- /drone/docker | |
# Mount the cache volume, needs "Trusted" | |
volumes: | |
- /tmp/cache:/cache |
- 通过
pip install pandora-chatgpt
安装依赖。 - 保存以下代码到
auto_pool_token.py
文件。 - 同目录新建文件
credentials.txt
一行一个账号密码。 - 账号和密码之间用
,
分隔,不需要额外的引号。 - 如果需要修改代理,
unique_name
等,自行修改再运行。 - 运行这个
auto_pool_token.py
。 - 你会看到运行进度,运行完成可看到
pool token
。 - 运行中间结果分别保存在同目录
tokens.txt
和share_tokens.txt
中。
国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。
Dockerized 实践 https://github.com/y0ngb1n/dockerized
Ubuntu 16.04+、Debian 8+、CentOS 7+
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
#!/bin/bash | |
readonly DB_FILE="$(pwd)/images.db" | |
readonly IMG_DIR="$(pwd)/images" | |
save-images() { | |
echo "Create ${DB_FILE}" | |
echo "$(docker images|grep -v 'IMAGE ID'|awk '{printf("%s %s %s\n", $1, $2, $3)}'|column -t)" > "${DB_FILE}" | |
echo "Read ${DB_FILE}" |
- Have Homebrew installed and a markdown file you want to render to PDF.
- Install Pandoc
brew install pandoc
- Install basictex
brew cask install basictex
- needed for the pdflatex tool. - Symlink the pdflatex to your
/usr/local/bin
so pandoc can easily find it.ln -s /Library/TeX/Root/bin/x86_64-darwin/pdflatex /usr/local/bin/pdflatex
- Use Pandoc to generate a PDF from a Markdown file.
pandoc input.md -o output.pdf
- By default the margins are pretty large. To optionally change the margins:
pandoc input.md -o output.pdf -V geometry:margin=1in