Created
July 1, 2011 09:17
-
-
Save nbogie/1058153 to your computer and use it in GitHub Desktop.
presentation of https://gist.github.com/1056734 for attempted readability
This file contains hidden or 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
echo -n | |
#quote-escaping removed from the following json | |
" | |
{"version": "1.1.0","host": "maps.google.com","request_address": true,"address_language": "en_GB", "wifi_towers": | |
[ | |
`iwlist scan 2> /dev/null | | |
tr -d '\n' | | |
sed -e 's/Cell [0-9]* - Address: \([0-9A-Z:]*\)[^C]*Channel:\([0-9]*\)[^S]*Signal level=\([0-9-]*\) dBm[^E]*E[^E]*ESSID:"\([^"]*\)"/\{"mac_address": "\1","signal_strength": \3,"age": 0,"channel": \2,"ssid": "\4"}/g' | |
-e 's/[^{]*{/{/' | |
-e 's/}[^{]*{/},{/g' | |
-e 's/\}[^}]*$/\}/' ` | |
] | |
} | |
" | |
| curl -s -X POST -d @/dev/fd/0 http://www.google.com/loc/json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment