Skip to content

Instantly share code, notes, and snippets.

Ed Summers edsu

Block or report user

Report or block edsu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View jobs.csv
job count
waitress 33
teacher 25
bartender 25
receptionist 18
lifeguard 16
waiter 14
dishwasher 14
graphic designer 14
barmaid 14
View bills.py
import json
import requests
# get maryland's current house members
key = "your_key_here"
headers = {"X-API-KEY": key}
url = 'https://api.propublica.org/congress/v1/members/house/md/current.json'
resp = requests.get(url, headers=headers)
@edsu
edsu / gist:dd92a2964e95782ce675
Last active Apr 12, 2019
Here's an example of the API call that WikiData's search box uses for suggesting entities. The suggestion is based on the text "ch" in the search URL query parameter.
View gist:dd92a2964e95782ce675
curl --silent 'https://www.wikidata.org/w/api.php?action=wbsearchentities&search=ch&format=json&language=en&type=item&continue=0' | python -m json.tool
{
"search": [
{
"aliases": [
"encyclopaedia",
"encyclop\u00e6dia"
],
"description": "type of reference work",
"id": "Q5292",
View get.py
import requests
key = "2B0i2oVrIov0sn69IL56GLcInvHqzv90E0U2kJLQ"
headers = {"X-API-KEY": key}
url = 'https://api.propublica.org/congress/v1/116/house/members.json'
resp = requests.get(url, headers=headers)
print(resp.json())
View get.py
import requests
key = "my_key"
headers = {"X-API-KEY": key}
url = 'https://api.propublica.org/congress/v1/116/house/members.json'
resp = requests.get(url, headers=headers)
print(resp.json())
View retweet_ratio.py
#!/usr/bin/env python3
import sys
from twarc import Twarc
screen_name = sys.argv[1]
twitter = Twarc()
tweets = 0
View obama-ids.txt
1113160564858122240
1113160564438650880
1113160563729862661
1113160562849054721
1113160560227627018
1113160559212421120
1113160556897292288
1113160556737957895
1113160555966197760
1113160555697668096
View blm.py
#!/usr/bin/env python3
import re
import csv
import json
import time
from requests_html import HTMLSession
def main():
@edsu
edsu / test.py
Last active Mar 27, 2019
Reading a string containing MARCXML with pymarc.
View test.py
from pymarc.marcxml import parse_xml_to_array
from io import StringIO
xml_text = open('test/batch.xml').read()
xml = StringIO(xml_text)
records = parse_xml_to_array(xml)
print(records)
View gist:475ab8e2f3307a5854faaf7fd06a1c02
[edsu@r001 ~]$ spark-shell --packages "io.archivesunleashed:aut:0.17.0"Ivy Default Cache set to: /home/edsu/.ivy2/cache
The jars for the packages stored in: /home/edsu/.ivy2/jars
:: loading settings :: url = jar:file:/home/edsu/.local/lib/python2.7/site-packages/pyspark/jars/ivy-2.4.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
io.archivesunleashed#aut added as a dependency
:: resolving dependencies :: org.apache.spark#spark-submit-parent-2ae7a372-bba6-482d-8fff-910ec07724ab;1.0
confs: [default]
found io.archivesunleashed#aut;0.17.0 in local-m2-cache
:: resolution report :: resolve 234ms :: artifacts dl 13ms
:: modules in use:
io.archivesunleashed#aut;0.17.0 from local-m2-cache in [default]
You can’t perform that action at this time.