Python Code Camp (Professionals) is a whole day workshop that aims to enable professionals to learn Python Basics and Django.
Visit: http://devcon.ph/events/python-code-camp-professionals-2016
5. Hello World
from gevent import monkey; monkey.patch_all()
from bottle import run, route
@route('/hello')
def fxn():
return "Hello World!"
run(server='gevent', host="localhost", port=8001,
debug=True)
6. Step
Import gevent and bottle
Magically replace synchronous libraries with
async counterparts
from gevent import monkey;
monkey.patch_all()
from bottle import run, route
7. Step
Assign the url /hello to the function below
@route('/hello')
Define a python function
def fxn():
Return “Hello World!” to the browser
return "Hello World!"
Activate the gevent server, listen on port 8001
run(server='gevent', host="localhost",
port=8001, debug=True)
8. Accepting Inputs
Via the url
http://www.gloopgroup.com/profile/paolo
Via query string
https://www.google.com.ph/?ion=1&q=gloopgroup
Via POST body
File upload to a website
9. Inputs in Bottle
Via the url
@route('/input1/<name>')
def greet(name):
return "Hello "+name
Visit: localhost:8001/input1/paolo
10. Inputs in Bottle
Via query string
@route('/sum')
def sum():
total = 0
start = int(request.query.get("start"))
end = int(request.query.get("end"))
for i in range(start,end):
total += i
return "Sum of "+str(start) + " to " +
str(end) + " = " + str(total)
Visit: localhost:8001/sum?start=1&end=10
11. Inputs in Bottle
Via POST body
@route('/input3', method="POST")
def greet():
for x in
return "Hello "+
request.json.get("name")
Visit: localhost:8001/input3 using postman
13. Cost per Mille =
• Cost per 1000 impressions
• Abuse of statistics
• i.e. Magic
• i.e. It sucks
• Not based on empirical measured data
ADVERTISING!
Eyeballs
cost
14. How many are watching
me right now?
How many are paying attention?
How many are interested?
How many are still reading this part?
How about now?
Now?
This is our current project onewatt. It’s a device that can save you up to 40% in your electricity bills by utilizing fluctuations in electricicty prices in WESM throughout the day. How?
I wont be talking about OneWatt. Since, apparently, Wilson deemed this thing not too thingie enough for the internet of things. So I’m going to talk about something more thingie…
I wont be talking about OneWatt. Since, apparently, Wilson deemed this thing not too thingie enough for the internet of things. So I’m going to talk about something more thingie…
I did this by exploiting one of the thingiest thinies right now, something that everyone here has on them most fo the time. Your mobile devices. Assuming that an average person has at least 1 devic eon them, I was able to get how many people walked by the screen, how many stayed for at least 2 secs, and how many people finished the ad.
I did this by exploiting one of the thingiest thinies right now, something that everyone here has on them most fo the time. Your mobile devices. Assuming that an average person has at least 1 devic eon them, I was able to get how many people walked by the screen, how many stayed for at least 2 secs, and how many people finished the ad.
I wont be talking about OneWatt. Since, apparently, Wilson deemed this thing not too thingie enough for the internet of things. So I’m going to talk about something more thingie…
I wont be talking about OneWatt. Since, apparently, Wilson deemed this thing not too thingie enough for the internet of things. So I’m going to talk about something more thingie…
I wont be talking about OneWatt. Since, apparently, Wilson deemed this thing not too thingie enough for the internet of things. So I’m going to talk about something more thingie…
I wont be talking about OneWatt. Since, apparently, Wilson deemed this thing not too thingie enough for the internet of things. So I’m going to talk about something more thingie…
I wont be talking about OneWatt. Since, apparently, Wilson deemed this thing not too thingie enough for the internet of things. So I’m going to talk about something more thingie…
I wont be talking about OneWatt. Since, apparently, Wilson deemed this thing not too thingie enough for the internet of things. So I’m going to talk about something more thingie…
I did this by exploiting one of the thingiest thinies right now, something that everyone here has on them most fo the time. Your mobile devices. Assuming that an average person has at least 1 devic eon them, I was able to get how many people walked by the screen, how many stayed for at least 2 secs, and how many people finished the ad.
One of the key metrics used in advertising is the number of eyeballs gained by an ad. Makes sense, since advertisers are paying to have their ads seen by the most amount of people. The problem with this though is that this number, or Cost per Mille, is an abuse of statistics, it is not based on a solid methodology.
So back then we did this media wall project in Shanghai. we wanted to prove how many people saw the ad, and how long people were looking at it.
So we devised a way to have more empirical data.
As of now, I can empirically estimate about ___________ watching me right now.
(turn on device and get count)
The setup is actually quite simple. You can even do it with a router, but for this purpose, I used a pi, connected to a wifi dongle, and this cute little screen i salvaged from an old tv, all powered by a power bank. Very mcgyvery.
This wifi transmitter is set to promiscuous mode, para syang carinderia na bukas sa lahat ng gutong kumain, actually worse, bukas kahit sa mga walang planong kumain. Using this, I am able to sniff all the traffic being trasmitted by all the dvices, specifically probe requests, within a certain range, (with this range varying based on the yyy used).
The CPU, running python, gets the output of tcpdump, mining all the sniffed mac addresses and adding timestamps to each record withing the vicinity, without them installing anything on their device or being aware. So right now I am getting all the mad accdresses of the devices of this group right here, since they are withing x meters form me, which I can now use to check for uniqueness, use for idnetification or use in whatever evil scheme I plan. Sounds excting diba? Borderline snooping.
We ran this on 2 pilot sites, one in Zhngshan park, and the other in Lujiazhui station. Using my setup, on the average, there were 23000 people who pass by our screens everyday, 36% of which stopped and watched for at least 2 secs, and around 10% stayed finished the 15 second ad.
So, especially for the group here <referto prev group>, so what if you got our mac addrsses, that doesn’t sound too bad, are there other possible application of this?
I have used this device in stores to measure foot traffic. I can identify how a customer moves between shelves, and identifying which items attract the most views. Which is important data for a retailer or advertiser.
You can also use this as a replacemnt for gps in geofencing. By attenuating the broadcast range to a specific area. You can then identify new and returning customers to your shop, and instruct your staff to be more accommodating to new customers going in.
And the most fun thing to do with this s probably just snoop. Imagine if we install one of these in each classroom. Using simple data such as class schedules, we can then relate a mac address to a specific student. Imagine then if we leave this device in the lagoon area. We will now have a list of people visiting that spot at say 10pm onwards. Who is meeting who, who is coming in in groups of 2 or even people coming in groups of 3 or more.
So in summary, turn off your phones when going to the lagoon.