Skip to content

Instantly share code, notes, and snippets.

View powerupcloud's full-sized avatar

Powerupcloud powerupcloud

View GitHub Profile
--Athena Query
SELECT extract(hour
FROM cast(pickup_datetime AS timestamp)) AS Hour, ROUND(AVG(cast(trip_distance AS double) / date_diff('second', cast(pickup_datetime AS timestamp), cast(dropoff_datetime AS timestamp))) * 3600,1)
FROM taxinyc
WHERE cast(dropoff_datetime AS timestamp) > cast(pickup_datetime AS timestamp)
AND cast(fare_amount AS double)/cast(trip_distance AS double)
BETWEEN 2
AND 10
AND cast(trip_distance AS double) > 0
@powerupcloud
powerupcloud / deploy.sh
Created February 11, 2016 15:04
Google Autoscaler deployments
#Get the list of the server names behind the instanstce group using gcloud compute and grep the initial words of the instance group and output to a file.
gcloud compute instance-groups managed list-instances prod-app-utoo-grp --zone asia-east1-a | grep -o "prod-app-utoo[^ ]*" > servername
#Get the IP addresses for the above server names and output to a file. Clean up the IP list file which may already be there from previous deployments
cat /dev/null > iplist
for app in `cat servername`
do
gcloud compute instances describe $app --zone asia-east1-a | grep 'natIP' | cut -f2 -d : >> iplist