Last active
July 12, 2021 06:18
-
-
Save notthetup/fa5e60368bc7b17574149ff0fc4cd64f to your computer and use it in GitHub Desktop.
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 bash | |
out="${1:-wifi-card.pdf}" | |
read -rp "SSID: " ssid | |
read -rsp "Password: " pass | |
echo -e "\nGenerating PDF..." | |
{ | |
cat << EOF | |
<table> | |
<tr> | |
<td><img src="data:image/png;base64,$(qrencode -o - -t png "WIFI:T:WPA;S:$ssid;P:$pass;;" | base64)"></td> | |
<td><span>SSID: $ssid</span><br><span>Password: $pass</span></td> | |
</tr> | |
</table> | |
<p> | |
<img width=16 height=16 src="https://raw.githubusercontent.com/iamcal/emoji-data/master/img-apple-64/1f4f8.png"> | |
<img width=16 height=16 src="https://raw.githubusercontent.com/iamcal/emoji-data/master/img-apple-64/1f4f1.png"> | |
Point your phone's camera at the QR Code to connect automatically. | |
</p> | |
EOF | |
} | pandoc --pdf-engine=xelatex -f html -t pdf -o "$out" | |
echo "$out" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment