Skip to content

Instantly share code, notes, and snippets.

View greglinch's full-sized avatar

Greg Linch greglinch

View GitHub Profile
@greglinch
greglinch / google_sheets_json.py
Last active March 14, 2017 17:35 — forked from nickjevershed/google-sheets-json.py
Python script (based on @nickjevershed's original) to convert Google spreadsheets to simple JSON file and save it locally and/or to S3. Assumes your data is on the left-most sheet (i.e. the default) and that you've already clicked the "Publish to the web" option in the "File" menu. S3 requires environment variables.
import os
import json
import argparse
import requests
import tinys3
'''
Modified version of nickjevershed's code
@greglinch
greglinch / download_congress_photos.py
Last active March 10, 2017 22:26
Set a list of congressional bio directory IDs in order to download members' photos. I used wget instead of requests because of a TLS handshake issue. For getting the IDs, see https://gist.github.com/greglinch/5197267b6ff8fcb19192ba5443f1f71d
import os
# dimensions = '225x275'
dimensions = 'original'
## add a list of IDs here based on http://bioguide.congress.gov/biosearch/biosearch.asp
id_list = []
images_downloaded = 0
@greglinch
greglinch / convert_congress.py
Last active March 10, 2017 22:26
Converts HTML table from congressional bio directory to a csv. For downloading images, see https://gist.github.com/greglinch/608001fa0ae39834af18354c9e8c6f09
from bs4 import BeautifulSoup
'''
Prereqs:
- Go to the congressional bio directory http://bioguide.congress.gov/biosearch/biosearch.asp
- Search the parameters you want
- inspect element and copy the html
- paste into a file and (optional?) wrap with <html></html> tags
@greglinch
greglinch / test-page.html
Last active October 18, 2018 15:19
Sample HTML page from Howard University ONA event
<html>
<head>
<title>This is my test page</title>
</head>
<body>
<h1>My article headline</h1>
<p>This is <em>my</em> article.</p>
<p>It's the <strong>greatest</strong> article ever written.</p>
</body>
</html>