Created
August 3, 2016 09:25
-
-
Save CharlieHawker/3d27ace8e8b1c5359c3141d8db33dc2d to your computer and use it in GitHub Desktop.
Useful bash aliases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Export variables from a .env file | |
alias setup_env_vars='export $(cat .env | xargs)' | |
# Display human-readable subdirectory sizes | |
alias subdirsizes="ls -AF | grep \/ | sed 's/\ /\\\ /g' | xargs du -sh" | |
# Heroku - Restore postgres backup to given database name | |
herokuPgBackupRestore() { | |
dbname=${1?param missing - database name} | |
heroku pg:backups capture | |
curl -o latest.dump `heroku pg:backups public-url` | |
pg_restore --no-acl --no-owner --clean -U postgres --dbname $dbname latest.dump | |
rm latest.dump | |
} | |
alias restore_heroku_backup=herokuPgBackupRestore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment