Skip to content

Instantly share code, notes, and snippets.

@nvk
Last active October 9, 2023 21:40
Show Gist options
  • Save nvk/1b45aea3e63201c65c5aed14304dd366 to your computer and use it in GitHub Desktop.
Save nvk/1b45aea3e63201c65c5aed14304dd366 to your computer and use it in GitHub Desktop.
QR codes on terminal for passing things to phone…
#!/usr/bin/env python3
import sys, pyqrcode
p = ' '.join(sys.argv[1:])
if not p:
p = sys.stdin.read().strip()
if not p:
print(f"Usage: {sys.argv[0]} data-for-qr or echo 'data-for-qr' | {sys.argv[0]}")
sys.exit(1)
q = pyqrcode.create(p)
print(q.terminal())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment