Skip to content

Instantly share code, notes, and snippets.

@markasoftware
Last active March 4, 2018 11:59
Show Gist options
  • Save markasoftware/1777d6999e9b9970d848cb832cb0e153 to your computer and use it in GitHub Desktop.
Save markasoftware/1777d6999e9b9970d848cb832cb0e153 to your computer and use it in GitHub Desktop.
Shadowsocks QR Code Generator
#!/bin/bash
# Make sure you have qrencode installed. Apart from that, you only need coreutils
read -p 'Algorithm? ' ss_algo
read -p 'Password? ' ss_pass
read -p 'Host? ' ss_host
read -p 'Port? ' ss_port
read -p 'Friendly name (optional)? ' ss_friend
read -p 'Output file name (in pwd)? ' ss_out
ss_encoded=$(echo -n "$ss_algo:$ss_pass@$ss_host:$ss_port" | base64 -w 0 - | tr -d '=')
[[ -n $ss_friend ]] && ss_url="ss://$ss_encoded#$ss_friend" || ss_url="ss://$ss_encoded"
qrencode -lM o "$ss_out" "$ss_url"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment