Skip to content

Instantly share code, notes, and snippets.

@brock
brock / psql-with-gzip-cheatsheet.sh
Last active June 27, 2024 10:09
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@texdc
texdc / hosted_zone_id.yml
Created October 6, 2017 21:06
Two ansible commands to get the Route53 zone id for a given DNS zone
---
- name: get hosted zone info
route53_facts:
query: hosted_zone
register: zone_info
- name: get zone id
set_fact:
zone_id: "{{ zone.Id | regex_replace('/hostedzone/', '') }}"
when: zone.Name == route53_zone + '.'