Skip to content

Instantly share code, notes, and snippets.

View emailrhoads's full-sized avatar

John Rhoads emailrhoads

View GitHub Profile
@emailrhoads
emailrhoads / dump RDS to sql
Last active August 2, 2022 15:27
[DB dump] #postgres #gemini
nohup pg_dump -h rds-gemini-dev.pnmac.com -U cmgemini -W -d cm_gemini_dev --no-owner --no-privileges --no-comments --format=custom --file=gemini.sql
pg_dump -h rds-vanna-dev.pnmac.com -U vannadev -W -d vanna_development --no-owner --no-privileges --no-comments --format=custom --file=vanna.sql
nohup pg_dump -h rds-luna-dev.pnmac.com -U lunadev -W -d luna_dev --no-owner --no-privileges --no-comments --format=custom --file=luna.sql
@emailrhoads
emailrhoads / pgdump on pg12 from AWS.sh
Created July 12, 2021 19:07
PGdump from AWS #aws
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update
sudo apt -y install postgresql-client-12
sudo apt -y install postgresql-12 postgresql-client-12
PGDATABASE=$GEMINI_DB PGHOST=$GEMINI_DB_HOST PGUSER=$GEMINI_DB_USER PGPASSWORD=$GEMINI_DB_PASSWORD pg_dump $GEMINI_DB -Ft -f cm_gemini_20210712.tar
@emailrhoads
emailrhoads / old_vs_new
Last active April 20, 2021 20:05
[CRA evaluate old vs new] #crape
old_results = Crape::BatchLoanRun.all;
with_attrs = old_results.map do |e|
e.slice('loan_number') + e.loan_run.attributes
end;
CSV.open("old_cra_results.tsv", "w", write_headers: true, headers: with_attrs.first.keys, col_sep: "\t") do |csv|
with_attrs.each do |h|
csv << h.values
end
@emailrhoads
emailrhoads / Rebase master russian doll strategy
Created April 19, 2021 14:44
Rebase and prefer master changes #git
`git rebase -X ours master # Short option`
ours will take the changes from master where conflicts occur
@emailrhoads
emailrhoads / read_tsv
Created January 13, 2021 16:17
[Read TSV to data frame] #ruby
CSV.parse(File.read("irregular_addr.tsv"),
col_sep: "\t",
headers: true,
).map(&:to_h);
@emailrhoads
emailrhoads / postgres service not found.md
Created January 7, 2021 21:49
[Postgres not connecting?] #docker

First try docker system prune --volumes

Also make sure you have: POSTGRES_HOST_AUTH_METHOD: trust set on both the app and the postgres service

@emailrhoads
emailrhoads / compare_missing_commit
Created January 7, 2021 18:30
[Compare the changes for a missing commit on master] #git
git diff <commit missing> master
git diff <commit missing> master -- <FILE OF INTEREST>
yarn prettier --write app/components/gemini/trader_pricing_grid_approval_view/client/trader_pricing_grid_approval_view.js
@emailrhoads
emailrhoads / kill_all_db_connections.sh
Created November 11, 2020 22:55
[Kill DB connnections] #aws
/etc/init.d/apache2 stop
/etc/init.d/monit stop
ps aux | grep delay >> kill DJs
rake db:drop
rake db:create
rake db:migrate
rake db:seed
/etc/init.d/apache2 restart
@emailrhoads
emailrhoads / cherry_pick_rebase
Last active November 5, 2020 15:37
[Cherry Pick Rebase] #git
https://stackoverflow.com/questions/2474353/how-to-copy-commits-from-one-branch-to-another
In the event you have some commits that you want to take off of a feature branch (i.e. cherry pick them all onto master), then you can run this rebase workflow.
git rebase --onto branch_to_apply_to branch_with_last_commit_to_ignore branch_you_want_to_apply