This file contains hidden or 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import argparse | |
import datetime | |
import os | |
import sys | |
import requests | |
from urllib.parse import urlparse |
This file contains hidden or 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
""" | |
YT-DLP FastAPI Server | |
===================== | |
A FastAPI-based web service for downloading videos from various platforms using yt-dlp. | |
Features include concurrent download management, progress tracking, API key authentication, | |
task persistence, and disk space management. | |
Installation | |
----------- |
This file contains hidden or 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
""" | |
该脚本用于将Docker镜像传输到腾讯云容器注册中心CCR。 | |
用法示例: | |
python transfer_docker_image_to_ccr.py <镜像名称> [--dry-run] [--arch <架构>] | |
参数: | |
<镜像名称>: 要传输的Docker镜像名称。 | |
--dry-run:打印命令而不执行。 | |
--arch <架构>: 镜像的架构,支持'arm64'和'amd64',默认为'amd64'。 |
This file contains hidden or 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
image: node:6-alpine | |
cache: | |
key: "$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME" | |
paths: | |
- node_modules/ | |
- yarn_cache/ | |
stages: | |
- setup |
This file contains hidden or 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
/** UI element heights which used in message height calculation */ | |
textPaddingVertical: number = 7; | |
textPaddingHorizontal: number = 10; | |
timeHeight: number = 12; | |
timeTopMargin: number = 5; | |
messageContainerVerticalMargin: number = 7; | |
dateSeperatorVerticalMargin: number = 20; | |
dateSeperatorHeight: number = 15; | |
imageHeight: number = 170; | |
imageBottomMargin: number = 10; |
This file contains hidden or 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
# rename.py | |
# usage: python3 rename.py ~/pics | |
import sys | |
from pathlib import Path | |
def print_usage(): | |
print('usage: python3 rename.py [target-dir]', file=sys.stderr) | |
This file contains hidden or 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
""" | |
Mac 喝水提示 | |
crontab -e | |
*/30 8-22/1 * * * [your python] [script path] | |
- 8点到20点每半小时提示一次喝水 | |
""" |
This file contains hidden or 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
# 生成 dhparam.pem 文件, 在命令行执行任一方法: | |
# 方法1: 很慢 | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 | |
# 方法2: 较快 | |
# 与方法1无明显区别. 2048位也足够用, 4096更强 | |
openssl dhparam -dsaparam -out /etc/nginx/ssl/dhparam.pem 4096 |
This file contains hidden or 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
function useFormik(props) { | |
// useState to keep the same observable around without recreating it on each render | |
const [formik] = React.useState(() => | |
mobx.observable({ | |
values: props.initialValues || {}, | |
touched: {} | |
}) | |
) | |
// just mutate state, this function itself can be considered an action+reducer |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
WARNING: Parsing of this file by third-party apps is not supported. The | |
file, and the font files it refers to, will be renamed and/or moved out | |
from their respective location in the next Android release, and/or the | |
format or syntax of the file may change significantly. If you parse this | |
file for information about system fonts, do it at your own risk. Your | |
application will almost certainly break with the next major Android | |
release. |
NewerOlder