Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import datetime
import os
import sys
import requests
from urllib.parse import urlparse
@aweffr
aweffr / app.py
Last active May 15, 2025 10:57
yt-dlp download service
"""
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
-----------
@aweffr
aweffr / transfer_docker_image_to_ccr.py
Created January 2, 2025 02:01
该脚本用于将Docker镜像传输到腾讯云容器注册中心CCR。
"""
该脚本用于将Docker镜像传输到腾讯云容器注册中心CCR。
用法示例:
python transfer_docker_image_to_ccr.py <镜像名称> [--dry-run] [--arch <架构>]
参数:
<镜像名称>: 要传输的Docker镜像名称。
--dry-run:打印命令而不执行。
--arch <架构>: 镜像的架构,支持'arm64'和'amd64',默认为'amd64'。
@aweffr
aweffr / .gitlab-ci.yml
Created May 25, 2022 07:24 — forked from zerda/.gitlab-ci.yml
Gitlab CI for front-end project
image: node:6-alpine
cache:
key: "$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME"
paths:
- node_modules/
- yarn_cache/
stages:
- setup
@aweffr
aweffr / index.js
Created April 3, 2022 08:52 — forked from davx1992/index.js
/** 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;
# 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)
"""
Mac 喝水提示
crontab -e
*/30 8-22/1 * * * [your python] [script path]
- 8点到20点每半小时提示一次喝水
"""
@aweffr
aweffr / nginx.conf
Created April 29, 2021 01:35 — forked from fotock/nginx.conf
Nginx SSL 安全配置最佳实践.
# 生成 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
@aweffr
aweffr / formik-mobx.js
Created March 12, 2021 06:02 — forked from danielkcz/formik-mobx.js
Formik with MobX
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
@aweffr
aweffr / fonts.xml
Created November 20, 2020 08:36
MIUI 12 字体列表
<?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.