Created
November 19, 2020 16:07
-
-
Save osvimer/075ba8ff504b19e9da9de985fdd64eae to your computer and use it in GitHub Desktop.
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 python | |
| # vim:fileencoding=utf-8 | |
| # you may want change this | |
| dest_url = 'https://img.vim-cn.com/' | |
| import sys | |
| from subprocess import Popen, PIPE | |
| args = [] | |
| for f in sys.argv[1:]: | |
| if f == '-': | |
| args.extend(['-F', 'name=@-;filename=-.png']) | |
| else: | |
| args.extend(['-F', 'name=@'+f]) | |
| cmd = ['curl', '--compressed', dest_url] + args | |
| p = Popen(cmd, stdout=PIPE) | |
| ret = p.wait() | |
| url = p.stdout.read() | |
| sys.stdout.buffer.write(url) | |
| sys.exit(ret) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment