qrencode -t utf8 'WIFI:T:WPA;S:network;P:password;;' qrencode -t utf8 'WIFI:T:WPA;S:network;P:password;;' read -rp "SSID: " ssid
read -rsp "Password: " pass
echo -e "\n"
qrencode -t utf8 "WIFI:T:WPA;S:$ssid;P:$pass;;"
echo "SSID: $ssid"
Even better, generate a PDF with emojis and all! #!/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"
I used those GitHub URLs for the emojis because pandoc was being weird about the unicode versions.Can someone please explain this command, and why it is presumably given as a criticism of this submission?
How could it work if it didn’t?
The only downside IMO is that you are entering your wifi details in to an untrusted website.
Do you know how long most "Show HN" links still work after a year or two?
But yes, I agree running a command like qrencode from terminal is easier in the long run.
The command line tool will have a longer life
The project is so simple that it would be easier to rewrite it from scratch in that time frame. But the qrencode CLI allows to just avoid that.
This doesn't look "simpler" after a quick look, and it's a hard dependency of the GP solution.
(I completely agree on the local-only guarantee that this one provides, though)
You're on your own machine, you know the exact spec used to generate the QR, and while you're at it, you can use the same tool to generate TOTP QR codes and WireGuard configurations and a bunch of other things like links to websites or automations for Tasker (et al).
The world is your oyster when you know what and how the "magic" works, and while you're at it, you aren't risking pasting your WiFi passwords into some random website.
Even this reply - this is intended as conversation.
"This should be the accepted answer."
WIFI:S:SSID;T:WPA3;P:PASSWORD;; nmcli device wifi show-passwordThis is now my favourite way to grab the WiFi password.
Why has it never occurred to me that I might be able to use a QR code? I always do `sudo cat /etc/NetworkManager/system-connections/TheSSID.nmconnection | grep psk`, type in my root password and then re-type the passphrase manually on my phone. The amount of time this is going to save me…
Write-Host "?">There are some standards -- de facto and otherwise -- already in use. This wiki attempts to catalog some possible standards for encoding various types of information, and suggest a standard action associated to them.
[1]: https://github.com/zxing/zxing/wiki/Barcode-Contents#wi-fi-n...
OTOH, I guess a "standard" is whatever the common implementations accept anyway, so if one could dig up the source to the WiFi QR scanner in source.android.com that's the 2nd best thing
> Special characters \, ;, ,, " and : should be escaped with a backslash (\) as in MECARD encoding.
I hear “%s%s%s%s%p” is the preferred SSID these days…