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
# vim: set shiftwidth=2 tabstop=2 softtabstop=-1 expandtab: | |
version: '3' | |
services: | |
files: | |
image: python:alpine | |
restart: unless-stopped | |
working_dir: /srv/files | |
volumes: |
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 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, |
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
#!/usr/bin/env python3 | |
# -*- coding:utf-8 -*- | |
""" | |
自动从中国下载vscode。 | |
使用前先预装: | |
pip install requests tqdm | |
使用示例: |
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 | |
echo "$@" | |
"$@" & | |
jobs -n | |
while [[ -z $(jobs -n) ]] | |
do | |
echo Wait... | |
sleep 2 |