Created
July 22, 2011 16:07
-
-
Save mattrose/1099738 to your computer and use it in GitHub Desktop.
Get the Stats from the Laurier street bike lane monitoring system
This file contains 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
cat << EOF > /dev/null | |
Alex deVries @mattrose the key is to use an AMF client like pyamf. | |
Jul 20 22:08:18 in reply to | |
>> Matt Rose @alexthepuffin I'll give it a shot. It may just be "automating the | |
hack" but I'll see what I can come up with based on yr description | |
>>>> Alex deVries For http://t.co/oCb5uZ1 , I need a couple of volunteers to do | |
one 2min task once per day. On vacation next week. #ottbike apply within | |
http://twitter.com/#!/alexthepuffin/status/93864847850225665 | |
EOF | |
rm -rf /tmp/getstats | |
mkdir /tmp/getstats | |
pushd /tmp/getstats | |
cat << 'EOF' > add.php | |
require_once 'fusionlib.php'; //include the php library | |
$google_login = "someusername"; | |
$google_password = "somepassword"; | |
$table_number=1111214; | |
$token = GoogleLogin($google_login, $google_password); | |
$ft = new FusionTable($token); // create new instance of FusionTable, pas sing the token | |
$date = $argv[1]; | |
$cyclists = $argv[2]; | |
$query="INSERT INTO $table_number (Date,Cyclists) ". | |
"VALUES ('$date','$cyclists')"; | |
EOF | |
sudo tcpdump -s0 -wout -ieth0 'src 94.23.11.79 and tcp port 8080' & | |
tcpdump_pid=$! | |
google-chrome http://public.visio-tools.com/?U15G1061058 | |
#xdg-open http://public.visio-tools.com/?U15G1061058 | |
sleep 5 | |
sudo kill $tcpdump_pid | |
ps auxw | grep public.visio-tools.com | awk '{print $2}' | xargs kill | |
ngrep -I out -O - -i journ | /usr/bin/tr -cd '\11\12\15\40-\176' | grep "/2011$" | ruby -e '$stdin.readlines.each { |e| e.lstrip! ; puts "php add.php #{e[-11..-1].chomp} #{e[1..-11]}" }' | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment