Skip to content

Instantly share code, notes, and snippets.

@abhinaykumar
abhinaykumar / how-to-copy-aws-rds-to-local.md
Created September 24, 2022 03:58 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@abhinaykumar
abhinaykumar / gist:4762e168d5f78fbb46edeec61a4abe65
Created March 12, 2020 08:55 — forked from guisehn/gist:6648c8fdcd1102a22a22
Backup Heroku Postgres database and restore to local database

Grab new backup

Command: heroku pg:backups capture -a [app_name]

Download

Command: curl -o latest.dump `heroku pg:backups public-url -a [app_name]`

Restore backup dump into local db

@abhinaykumar
abhinaykumar / break.py
Created September 25, 2018 06:55 — forked from obfusk/break.py
python equivalent of ruby's binding.pry
import code; code.interact(local=dict(globals(), **locals()))
@abhinaykumar
abhinaykumar / rails http status codes
Created April 27, 2018 04:50 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing