Skip to content

Instantly share code, notes, and snippets.

@tjmw
tjmw / gist:6113202
Last active January 10, 2021 18:03
Migrate a MySQL DB to Postgres on Heroku

Migrating a MySQL DB to a Heroku Postgres Instance

1. Create a MySQL Dump

mysqldump -h<host> --compatible=postgresql -u<user> -p <database_name> > /tmp/my_dump.sql

2. Import MySQL dump locally

cat my_dump.sql | mysql -h<host> -u<user> -p <database_name>
@tjmw
tjmw / gist:5390765
Last active December 16, 2015 06:19
Show (up to a max of) 5 most recently checked out branches in Git
git reflog \
| awk '{ print $3, $NF }' \
| grep "^checkout:" \
| awk '{ print $2 }' \
| egrep -v '^([0-9a-f]{40}|[0-9a-f]{7}$)' \
| perl -ne 'print unless $a{$_}++' \
| head -5