Skip to content

Instantly share code, notes, and snippets.

View sayhiben's full-sized avatar

Ben Menesini sayhiben

View GitHub Profile
@sayhiben
sayhiben / pg_import_csv_to_heroku.sh
Created October 27, 2015 22:33 — forked from jboesch/pg_import_csv_to_heroku.sh
Importing a CSV dump of Postgres data into Heroku
# You have your csv data and it looks like so... It's in a file named "my_data.csv" and we want to import it into a table named "my_things".
"1", "Something", "0.50", "2013-05-05 10:00:00"
"2", "Another thing", "1.50", "2013-06-05 10:30:00"
# Now you want to import it, go to the command line and type:
$ PGPASSWORD=PWHERE psql -h HOSTHERE -U USERHERE DBNAMEHERE -c "\copy my_things FROM 'my_data.csv' WITH CSV;"
# Voila! It's impoted. Now if you want to wipe it out and import a fresh one, you would do this:
@sayhiben
sayhiben / good_dog_scraper.py
Last active April 6, 2021 17:35
Save a list of available puppies on GoodDog.com in specific breeds to CSV - GoodDog.com's UX is based on navigating from breed -> breeder -> puppies. There are no options to browse available puppies across breeds or even to identify which breeders may soon have another litter. Good Dog expects its users to dig through its listings, page by page,…
import csv
import logging
import requests
import time
logging.basicConfig(level=logging.NOTSET)
logger = logging.getLogger(__name__)
# Seconds between requests
RATE_LIMIT = 2