Ever wanted to serve a file from bash to a mobile device by using a barcode? here you go:
#!/bin/bash
# mhhh ... hack!
IP=$(ip a | grep inet | grep -v 127 | grep -v inet6 | grep wlan0 | cut -d "/" -f 1 | awk '{ print $NF }')
qrencode -t ANSI256 "http://$IP:8000/$1"
# Send initial message for the barcode reader
echo -n -e "HTTP/1.0 200 OK\r\nServer: bash and nc\r\nDate: $(date -R)\r\nContent-type: text/html\r\nContent-length: 5\r\n\r\nHUHU" | nc -l $IP 8000
echo "yes!"
# Send the real file
echo -n -e "HTTP/1.0 200 OK\r\nServer: bash and nc\r\nDate: $(date -R)\r\nContent-type: application/octet-stream\r\nContent-length: $(du -b $1 | awk '{ print $1 }')\r\n\r\n$(cat $1)" | nc -l $IP 8000
The first netcat is just to trick the barcode scanner (it will request the url to retreive the name).
Better use Firefox for Android and not Chrome (which does magic shit and will not download the file...)!
You need qrencode and netcat-openbsd (and bash and awk and cut du and date and ip and grep....)