SlideShare a Scribd company logo
1 of 25
@sfusgs Geo-tweet my quake… @ayman • yahoo! research http://en.wikipedia.org/wiki/File:San_francisco_1906_earthquake.jpg
Zync • Y! Messenger
FireEagle
FireEagle @ayman
http://bit.ly/statler
shake and rumble in 2GA
http://earthquake.usgs.gov/earthquakes/recenteqsus/Quakes/nc71336726.php
Click through maps…
A Want Ad
USGS lists every quake
http://earthquake.usgs.gov/earthquakes/catalogs/
http://earthquake.usgs.gov/earthquakes/catalogs/
Trust me, it is just XML
Yahoo! Search goes to YDN
Google Search goes to YDN
Bing goes to YDN
Using ElementTree
The flow was simple CRON this:: cUrl XML feed from USGS find local quakes bit.ly the quake permalink if not duplicate record this quake tweet this quake
def fetch_quakes(): def fetch_quakes(): api = bitly.Api(login=’ABCDEF', apikey=’12345678901234567890') rss = parse(urllib.urlopen(USGS_URL)).getroot()     quakes = []     for element in rss.findall('{%s}entry' % USGS_NS):         title = element.findtext('{%s}title' % USGS_NS)        if (title.find("San Francisco Bay") > -1):             point = element.findtext('{%s}point' % GEORSS_NS)             points = point.split(None, 1)             link = element.find('{%s}link' % USGS_NS) href = 'http://earthquakes.usgs.gov%s' % link.get('href') href = api.shorten(href)           if (is_duplicate(href) is False): f = open(‘urls.txt', 'a') f.write('%s' % href) f.close()                 summary = element.findtext('{%s}summary' % USGS_NS)                 summary = summary.split("<br>")[1]                 summary = summary.replace(' at epicenter</p><p>', ' ')                 summary = strip_tags(summary) quakes.append({'title': element.findtext('{%s}title' % USGS_NS),                                'link' : href,                                'updated' : element.findtext('{%s}updated' % USGS_NS),                                'long' : points[1],                                'lat' : points[0],                                'elev' : element.findtext('{%s}elev' % GEORSS_NS),                                'summary' : summary})     return quakes
def is_duplicate(url): def is_duplicate(url):     from subprocess import call if(os.path.exists(‘urls.txt') is False):         call(['/usr/bin/touch', ‘urls.txt']) r = call(['/bin/fgrep', url,               ‘urls.txt'])     if (r == 0):         return True     else:         return False
def send_tweet(t): def send_tweet(t):     import httplib2     username = ’ABCDEFG'     password = ’12345678901234567890' msg = ('%s %s %s' % (t['title'], t['link'], t['summary']))     http = httplib2.Http() http.add_credentials(username, password)     response = http.request(         "http://twitter.com/statuses/update.xml",         "POST", urllib.urlencode({"status": msg,                            "lat": t['lat'],                            "long": t['long']})     ) SEE: http://code.google.com/p/httplib2/ ps: you shouldn’t store your passwords like that…this is just an illustration
fin
Crunched
USGS on Open Gov’t
Open Questions? How can other local sources be disseminated? How can mass media be filtered so it can be consumed in a similar manner? Can we collect information around the news? For example, find all the tweets that relate to a particular quake. Thanks, @ayman.

More Related Content

What's hot

20 modules i haven't yet talked about
20 modules i haven't yet talked about20 modules i haven't yet talked about
20 modules i haven't yet talked aboutTatsuhiko Miyagawa
 
Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"Webmontag Berlin
 
Perlのsmart match演算子
Perlのsmart match演算子Perlのsmart match演算子
Perlのsmart match演算子ast_j
 
Robert Murdock Band Brings 60s back to S.A. (The Suburban)
Robert Murdock Band Brings 60s back to S.A. (The Suburban)Robert Murdock Band Brings 60s back to S.A. (The Suburban)
Robert Murdock Band Brings 60s back to S.A. (The Suburban)Jacqueline Durett
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First WidgetChris Wilcoxson
 
The Joy of Smartmatch
The Joy of SmartmatchThe Joy of Smartmatch
The Joy of SmartmatchAndrew Shitov
 
Simulating Artificial Muscles for Controlling a Robotic Arm with Fluctuation
Simulating Artificial Muscles for Controlling a Robotic Arm with FluctuationSimulating Artificial Muscles for Controlling a Robotic Arm with Fluctuation
Simulating Artificial Muscles for Controlling a Robotic Arm with FluctuationMax Braun
 
LAMP_TRAINING_SESSION_1
LAMP_TRAINING_SESSION_1LAMP_TRAINING_SESSION_1
LAMP_TRAINING_SESSION_1umapst
 
pt-query-digest は Perl!!
pt-query-digest は Perl!!pt-query-digest は Perl!!
pt-query-digest は Perl!!Takafumi ONAKA
 
FrontendLab: Programming UI with FRP and Bacon js - Вячеслав Ворончук
FrontendLab: Programming UI with FRP and Bacon js - Вячеслав ВорончукFrontendLab: Programming UI with FRP and Bacon js - Вячеслав Ворончук
FrontendLab: Programming UI with FRP and Bacon js - Вячеслав ВорончукGeeksLab Odessa
 
PerlでWeb API入門
PerlでWeb API入門PerlでWeb API入門
PerlでWeb API入門Yusuke Wada
 

What's hot (12)

20 modules i haven't yet talked about
20 modules i haven't yet talked about20 modules i haven't yet talked about
20 modules i haven't yet talked about
 
Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"
 
Perlのsmart match演算子
Perlのsmart match演算子Perlのsmart match演算子
Perlのsmart match演算子
 
Robert Murdock Band Brings 60s back to S.A. (The Suburban)
Robert Murdock Band Brings 60s back to S.A. (The Suburban)Robert Murdock Band Brings 60s back to S.A. (The Suburban)
Robert Murdock Band Brings 60s back to S.A. (The Suburban)
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First Widget
 
Perl6 in-production
Perl6 in-productionPerl6 in-production
Perl6 in-production
 
The Joy of Smartmatch
The Joy of SmartmatchThe Joy of Smartmatch
The Joy of Smartmatch
 
Simulating Artificial Muscles for Controlling a Robotic Arm with Fluctuation
Simulating Artificial Muscles for Controlling a Robotic Arm with FluctuationSimulating Artificial Muscles for Controlling a Robotic Arm with Fluctuation
Simulating Artificial Muscles for Controlling a Robotic Arm with Fluctuation
 
LAMP_TRAINING_SESSION_1
LAMP_TRAINING_SESSION_1LAMP_TRAINING_SESSION_1
LAMP_TRAINING_SESSION_1
 
pt-query-digest は Perl!!
pt-query-digest は Perl!!pt-query-digest は Perl!!
pt-query-digest は Perl!!
 
FrontendLab: Programming UI with FRP and Bacon js - Вячеслав Ворончук
FrontendLab: Programming UI with FRP and Bacon js - Вячеслав ВорончукFrontendLab: Programming UI with FRP and Bacon js - Вячеслав Ворончук
FrontendLab: Programming UI with FRP and Bacon js - Вячеслав Ворончук
 
PerlでWeb API入門
PerlでWeb API入門PerlでWeb API入門
PerlでWeb API入門
 

Similar to SFUSGS

Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineAndy McKay
 
Exploiting Php With Php
Exploiting Php With PhpExploiting Php With Php
Exploiting Php With PhpJeremy Coates
 
Exploring the Sweet Spot: Geolocation, Health, and Gov-data
Exploring the Sweet Spot: Geolocation, Health, and Gov-data Exploring the Sweet Spot: Geolocation, Health, and Gov-data
Exploring the Sweet Spot: Geolocation, Health, and Gov-data Lance Roggendorff
 
Place not Space; Geo without Maps
Place not Space; Geo without MapsPlace not Space; Geo without Maps
Place not Space; Geo without MapsGary Gale
 
Summit2011 satellites-robinf-20110605
Summit2011 satellites-robinf-20110605Summit2011 satellites-robinf-20110605
Summit2011 satellites-robinf-20110605Robin Fernandes
 
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...Atlassian
 
rules, events and workflow
rules, events and workflowrules, events and workflow
rules, events and workflowMark Proctor
 
jQuery Performance Rules
jQuery Performance RulesjQuery Performance Rules
jQuery Performance Rulesnagarajhubli
 
Cheap frontend tricks
Cheap frontend tricksCheap frontend tricks
Cheap frontend tricksambiescent
 
Advanced and Hidden WordPress APIs
Advanced and Hidden WordPress APIsAdvanced and Hidden WordPress APIs
Advanced and Hidden WordPress APIsandrewnacin
 
My First Rails Plugin - Usertext
My First Rails Plugin - UsertextMy First Rails Plugin - Usertext
My First Rails Plugin - Usertextfrankieroberto
 
Zoo management adri jovin
Zoo management  adri jovinZoo management  adri jovin
Zoo management adri jovinAdri Jovin
 
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011John Ford
 
WordPressでIoTをはじめよう
WordPressでIoTをはじめようWordPressでIoTをはじめよう
WordPressでIoTをはじめようYuriko IKEDA
 
Scripting GeoServer with GeoScript
Scripting GeoServer with GeoScriptScripting GeoServer with GeoScript
Scripting GeoServer with GeoScriptJustin Deoliveira
 

Similar to SFUSGS (20)

JQuery Basics
JQuery BasicsJQuery Basics
JQuery Basics
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App Engine
 
Exploiting Php With Php
Exploiting Php With PhpExploiting Php With Php
Exploiting Php With Php
 
Exploring the Sweet Spot: Geolocation, Health, and Gov-data
Exploring the Sweet Spot: Geolocation, Health, and Gov-data Exploring the Sweet Spot: Geolocation, Health, and Gov-data
Exploring the Sweet Spot: Geolocation, Health, and Gov-data
 
Ae internals
Ae internalsAe internals
Ae internals
 
Prototype js
Prototype jsPrototype js
Prototype js
 
Place not Space; Geo without Maps
Place not Space; Geo without MapsPlace not Space; Geo without Maps
Place not Space; Geo without Maps
 
Summit2011 satellites-robinf-20110605
Summit2011 satellites-robinf-20110605Summit2011 satellites-robinf-20110605
Summit2011 satellites-robinf-20110605
 
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
 
Scala 2 + 2 > 4
Scala 2 + 2 > 4Scala 2 + 2 > 4
Scala 2 + 2 > 4
 
rules, events and workflow
rules, events and workflowrules, events and workflow
rules, events and workflow
 
jQuery Performance Rules
jQuery Performance RulesjQuery Performance Rules
jQuery Performance Rules
 
Cheap frontend tricks
Cheap frontend tricksCheap frontend tricks
Cheap frontend tricks
 
Advanced and Hidden WordPress APIs
Advanced and Hidden WordPress APIsAdvanced and Hidden WordPress APIs
Advanced and Hidden WordPress APIs
 
My First Rails Plugin - Usertext
My First Rails Plugin - UsertextMy First Rails Plugin - Usertext
My First Rails Plugin - Usertext
 
Zoo management adri jovin
Zoo management  adri jovinZoo management  adri jovin
Zoo management adri jovin
 
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011
 
JSON and the APInauts
JSON and the APInautsJSON and the APInauts
JSON and the APInauts
 
WordPressでIoTをはじめよう
WordPressでIoTをはじめようWordPressでIoTをはじめよう
WordPressでIoTをはじめよう
 
Scripting GeoServer with GeoScript
Scripting GeoServer with GeoScriptScripting GeoServer with GeoScript
Scripting GeoServer with GeoScript
 

More from David Shamma

Recommending Actions, Not Content
Recommending Actions, Not ContentRecommending Actions, Not Content
Recommending Actions, Not ContentDavid Shamma
 
Staying together: Understanding People and Media in Synchronous Connected Sy...
Staying together:  Understanding People and Media in Synchronous Connected Sy...Staying together:  Understanding People and Media in Synchronous Connected Sy...
Staying together: Understanding People and Media in Synchronous Connected Sy...David Shamma
 
Human to Dancer Interaction: Designing for Embodied Performances in a Partici...
Human to Dancer Interaction: Designing for Embodied Performances in a Partici...Human to Dancer Interaction: Designing for Embodied Performances in a Partici...
Human to Dancer Interaction: Designing for Embodied Performances in a Partici...David Shamma
 
A Movie And A Chat
A Movie And A ChatA Movie And A Chat
A Movie And A ChatDavid Shamma
 
Synergies Between Search and Social Metrics
Synergies Between Search and Social MetricsSynergies Between Search and Social Metrics
Synergies Between Search and Social MetricsDavid Shamma
 
Video Creativity beyond Dissemination
Video Creativity beyond DisseminationVideo Creativity beyond Dissemination
Video Creativity beyond DisseminationDavid Shamma
 
Watch What I Watch
Watch  What  I  WatchWatch  What  I  Watch
Watch What I WatchDavid Shamma
 

More from David Shamma (9)

Recommending Actions, Not Content
Recommending Actions, Not ContentRecommending Actions, Not Content
Recommending Actions, Not Content
 
Staying together: Understanding People and Media in Synchronous Connected Sy...
Staying together:  Understanding People and Media in Synchronous Connected Sy...Staying together:  Understanding People and Media in Synchronous Connected Sy...
Staying together: Understanding People and Media in Synchronous Connected Sy...
 
Human to Dancer Interaction: Designing for Embodied Performances in a Partici...
Human to Dancer Interaction: Designing for Embodied Performances in a Partici...Human to Dancer Interaction: Designing for Embodied Performances in a Partici...
Human to Dancer Interaction: Designing for Embodied Performances in a Partici...
 
A Movie And A Chat
A Movie And A ChatA Movie And A Chat
A Movie And A Chat
 
Tweet the Debates
Tweet the DebatesTweet the Debates
Tweet the Debates
 
Synergies Between Search and Social Metrics
Synergies Between Search and Social MetricsSynergies Between Search and Social Metrics
Synergies Between Search and Social Metrics
 
Spinning Online
Spinning OnlineSpinning Online
Spinning Online
 
Video Creativity beyond Dissemination
Video Creativity beyond DisseminationVideo Creativity beyond Dissemination
Video Creativity beyond Dissemination
 
Watch What I Watch
Watch  What  I  WatchWatch  What  I  Watch
Watch What I Watch
 

Recently uploaded

Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 

Recently uploaded (20)

Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 

SFUSGS

  • 1. @sfusgs Geo-tweet my quake… @ayman • yahoo! research http://en.wikipedia.org/wiki/File:San_francisco_1906_earthquake.jpg
  • 2. Zync • Y! Messenger
  • 13. Trust me, it is just XML
  • 18. The flow was simple CRON this:: cUrl XML feed from USGS find local quakes bit.ly the quake permalink if not duplicate record this quake tweet this quake
  • 19. def fetch_quakes(): def fetch_quakes(): api = bitly.Api(login=’ABCDEF', apikey=’12345678901234567890') rss = parse(urllib.urlopen(USGS_URL)).getroot() quakes = [] for element in rss.findall('{%s}entry' % USGS_NS): title = element.findtext('{%s}title' % USGS_NS) if (title.find("San Francisco Bay") > -1): point = element.findtext('{%s}point' % GEORSS_NS) points = point.split(None, 1) link = element.find('{%s}link' % USGS_NS) href = 'http://earthquakes.usgs.gov%s' % link.get('href') href = api.shorten(href) if (is_duplicate(href) is False): f = open(‘urls.txt', 'a') f.write('%s' % href) f.close() summary = element.findtext('{%s}summary' % USGS_NS) summary = summary.split("<br>")[1] summary = summary.replace(' at epicenter</p><p>', ' ') summary = strip_tags(summary) quakes.append({'title': element.findtext('{%s}title' % USGS_NS), 'link' : href, 'updated' : element.findtext('{%s}updated' % USGS_NS), 'long' : points[1], 'lat' : points[0], 'elev' : element.findtext('{%s}elev' % GEORSS_NS), 'summary' : summary}) return quakes
  • 20. def is_duplicate(url): def is_duplicate(url): from subprocess import call if(os.path.exists(‘urls.txt') is False): call(['/usr/bin/touch', ‘urls.txt']) r = call(['/bin/fgrep', url, ‘urls.txt']) if (r == 0): return True else: return False
  • 21. def send_tweet(t): def send_tweet(t): import httplib2 username = ’ABCDEFG' password = ’12345678901234567890' msg = ('%s %s %s' % (t['title'], t['link'], t['summary'])) http = httplib2.Http() http.add_credentials(username, password) response = http.request( "http://twitter.com/statuses/update.xml", "POST", urllib.urlencode({"status": msg, "lat": t['lat'], "long": t['long']}) ) SEE: http://code.google.com/p/httplib2/ ps: you shouldn’t store your passwords like that…this is just an illustration
  • 22. fin
  • 24. USGS on Open Gov’t
  • 25. Open Questions? How can other local sources be disseminated? How can mass media be filtered so it can be consumed in a similar manner? Can we collect information around the news? For example, find all the tweets that relate to a particular quake. Thanks, @ayman.

Editor's Notes

  1. Use d to be you could look out the window…
  2. I’m from Y!R MESS IEG.
  3. Toms first quake.