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
license: apache-2.0 |
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
keywords = "inequality" | |
sources = [28, # Miami Helard | |
39] # South Florida Sun Sentinel | |
collections = [38379430] # Florida state & local | |
mc = mediacloud.api.AdminMediaCloud(API_KEY) | |
# how many sentences have used this word in the last 3 months? | |
print(mc.sentenceCount(keywords, ["media_id: ({})".format(" ".join(map(str, sources))), | |
'publish_date:NOW to NOW-3MONTH'])) | |
# how many stories have used this word in the last 3 months? | |
print(mc.storyCount(keywords, ["media_id: ({})".format(" ".join(map(str, sources))), |
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
def media_with_tag(tags_id, cached=False): | |
more_media = True | |
all_media = [] | |
max_media_id = 0 | |
while more_media: | |
media = mc.mediaList(tags_id=tags_id, last_media_id=max_media_id, rows=100) | |
all_media = all_media + media | |
if len(media) > 0: | |
max_media_id = media[len(media) - 1]['media_id'] | |
more_media = len(media) != 0 |
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
all_stories = [] | |
florida_collection_id = 38379430 | |
stories_per_page = 50 | |
last_id = 0 | |
more_stories = True | |
while more_stories: | |
story_page = mc.storyList('(puppy OR puppies) AND tags_id_media:{}'.format(florida_collection_id), | |
'publish_date:[NOW-30DAY TO NOW]', last_processed_stories_id=last_id, | |
rows=stories_per_page) | |
if len(story_page ) is 0: |
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
# gem install httparty | |
# gem install nokogiri | |
# gem install feedjira | |
require 'httparty' | |
require 'nokogiri' | |
require 'feedjira' | |
module ItunesToRSS | |
def self.extract(url) | |
headers = { 'User-Agent' => 'iTunes/10.1 (Windows; U; Microsoft Windows XP Home Edition Service Pack 2 (Build 2600)) DPI/96' } |
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
{ | |
"$schema": "https://vega.github.io/schema/vega/v5.json", | |
"background": "white", | |
"padding": 5, | |
"width": 800, | |
"height": 300, | |
"style": "cell", | |
"data": [ | |
{"name": "selector304_store"}, | |
{ |
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
date | count | total | percentage | word | |
---|---|---|---|---|---|
2019-12-30 | 3 | 49 | 0.0612 | bigoted | |
2020-01-06 | 3 | 84 | 0.0357 | bigoted | |
2020-01-13 | 2 | 83 | 0.0241 | bigoted | |
2020-01-20 | 1 | 137 | 0.0073 | bigoted | |
2020-01-27 | 3 | 236 | 0.0127 | bigoted | |
2020-02-03 | 4 | 268 | 0.0149 | bigoted | |
2020-02-10 | 5 | 203 | 0.0246 | bigoted | |
2020-02-17 | 3 | 286 | 0.0105 | bigoted | |
2020-02-24 | 3 | 220 | 0.0136 | bigoted |
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
{ | |
"coord": { | |
"lon": -71.0589, | |
"lat": 42.3601 | |
}, | |
"weather": [ | |
{ | |
"id": 701, | |
"main": "Mist", | |
"description": "mist", |
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
#include <Servo.h> // use a set of functions to control the servo | |
int potPosition; // keep track of the potentiometer's last value | |
int dataIndex; // keep track of the index of the data item we're showing | |
int servoPosition; // keep track of where the servo is | |
Servo myservo; // make a servo helper object | |
int SERVO_PIN = 3; // the phyiscal pin we'll attach the servo to | |
int data[] = {1,10,10,10,1,2,4,5,10,10,0}; // an array of made up data |
OlderNewer