import sys | |
import subprocess | |
import tempfile | |
import urllib | |
text = sys.stdin.read() | |
chart_url_template = ('http://chart.apis.google.com/chart?' | |
'cht=qr&chs=300x300&chl={data}&chld=H|0') | |
chart_url = chart_url_template.format(data=urllib.quote(text)) | |
with tempfile.NamedTemporaryFile(mode='w', suffix='.png') as f: | |
subprocess.check_call(['curl', '-L', chart_url], | |
stdout=f, stderr=sys.stderr) | |
subprocess.check_call(['qlmanage', '-p', f.name]) |
This comment has been minimized.
This comment has been minimized.
DaveCollinsJr
commented
Mar 18, 2013
@zacharyvoase most impressive! |
This comment has been minimized.
This comment has been minimized.
stou
commented
Mar 15, 2014
Nice idea. Could not get the qrencode module to install in OS X mavericks FWIW, I've put together this little script instead
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Mic92 commentedMar 17, 2013
Heres Is my version.
It doesn't depend on the google api, but on qrencode.
So no internet connection is needed.
Instead of launching quicklook, it opens (hopefully) the default viewer of the underlying os.
usage:
or:
On linux it can be used like this, to encode the clipboard as qrcode:
On MacOS: