Skip to content

Instantly share code, notes, and snippets.

View yanqd0's full-sized avatar
😎
Learning...

Yan QiDong yanqd0

😎
Learning...
View GitHub Profile
@yanqd0
yanqd0 / cndlvsc.py
Created May 31, 2020 09:00
Download vscode faster in China
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
自动从中国下载vscode。
使用前先预装:
pip install requests tqdm
使用示例:
@yanqd0
yanqd0 / dl_requests_tqdm.py
Last active March 29, 2024 22:02
Python requests download file with a tqdm progress bar
import requests
from tqdm import tqdm
def download(url: str, fname: str, chunk_size=1024):
resp = requests.get(url, stream=True)
total = int(resp.headers.get('content-length', 0))
with open(fname, 'wb') as file, tqdm(
desc=fname,
total=total,
@yanqd0
yanqd0 / docker-compose.yaml
Last active October 19, 2018 04:13
The docker-compose.yaml about a http server for files with Python
# vim: set shiftwidth=2 tabstop=2 softtabstop=-1 expandtab:
version: '3'
services:
files:
image: python:alpine
restart: unless-stopped
working_dir: /srv/files
volumes: