Skip to content

Commit

Permalink
add geo-info for telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
idea4good committed Dec 24, 2020
1 parent 61f6eca commit 87dcf31
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion workspace/.sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,33 @@ curl --include --request POST --header "Content-Type: application/json" --data-b
\"project_info\" :\"$1\",
\"time\" :\"$build_time\",
\"weight\" :1
}]" $url
}]" $url > /dev/null

#--------------- Geo info ----------------#
curl ipinfo.io > ip_info.txt # get IP info

grep city ip_info.txt > ip_city.txt # filter city
sed -i 's/"city"://g' ip_city.txt #remove property name
sed -i 's/"//g' ip_city.txt #remove double quotes
city=`sed 's/,//g' ip_city.txt` #remove comma

grep country ip_info.txt > ip_country.txt # filter country
sed -i 's/"country"://g' ip_country.txt #remove property name
sed -i 's/"//g' ip_country.txt #remove double quotes
country=`sed 's/,//g' ip_country.txt` #remove comma

grep org ip_info.txt > ip_org.txt # filter org
sed -i 's/"org"://g' ip_org.txt #remove property name
sed -i 's/"//g' ip_org.txt #remove double quotes
org=`sed 's/,//g' ip_org.txt` #remove comma

url="https://api.powerbi.com/beta/72f988bf-86f1-41af-91ab-2d7cd011db47/datasets/d6c4145f-2fdc-4071-94f7-fbdb090914d4/rows?key=pQ7GFsXkAqJij4v%2BadZDoth6HB%2BmjZbAn0d%2B%2BtlWnE3jpm1s0lGKoFeFV7aF1QQ7PKOYGpQYYCkS0tjzxTgbLQ%3D%3D"

curl --include --request POST --header "Content-Type: application/json" --data-binary "[{
\"county\" :\"$country\",
\"city\" :\"$city\",
\"organization\" :\"$org\",
\"weight\" :1
}]" $url > /dev/null

rm ip_*

0 comments on commit 87dcf31

Please sign in to comment.