sudo apt-get install python3-pip
sudo pip3 install virtualenv 
| using System.Xml; | |
| using System.Xml.Linq; | |
| namespace XmlLib | |
| { | |
| /// <summary> | |
| /// Provides extension methods for simple conversion between System.Xml and System.Xml.Linq classes. | |
| /// </summary> | |
| /// <remarks>From: http://brianary.blogspot.com/2010/02/converting-between-xdocument-and.html</remarks> | |
| public static class XmlLinqConversionExtensions | 
| -- Get Max ID from table | |
| SELECT MAX(id) FROM table; | |
| -- Get Next ID from table | |
| SELECT nextval('table_id_seq'); | |
| -- Set Next ID Value to MAX ID | |
| SELECT setval('table_id_seq', (SELECT MAX(id) FROM table)); | 
| pg_restore --clean --no-acl --no-owner -d <database> -U <user> <filename.dump> | 
| /Library/PostgreSQL/9.1/bin/pg_dump --host localhost --port 5432 --username <USERNAME> -b -c -E UTF-8 --no-owner --no-privileges --no-tablespaces --clean --schema public -F c -Z 9 -f <BACKUPFILENAME> <DATABASENAME> | |
| /Library/PostgreSQL/9.1/bin/pg_restore --host localhost --port 5432 --username <USERNAME> --dbname <DATABASENAME> --no-owner --no-privileges --no-tablespaces --clean --schema public "<BACKUPFILENAME>" | 
My notes for Dokku on Digital Ocean.
These may be a bit outdated: Since I originally wrote them, I've reinstalled on a newer Dokku and may not have updated every section below.
Install dokku-cli (gem install dokku-cli) for a more Heroku-like CLI experience (dokku config:set FOO=bar).
# List/run commands when not on Dokku server (assuming a "henroku" ~/.ssh/config alias)
ssh henroku dokku
| #! /bin/bash | |
| # For use with Flink/dokku-psql-single-container. | |
| # Based on http://donpottinger.net/blog/2014/11/25/postgres-backups-with-dokku.html | |
| set -e | |
| BASE_DIR="/var/backups/postgres" | |
| mkdir -p $BASE_DIR | |
| YMD=$(date "+%Y-%m-%d") | 
| #! /bin/bash | |
| # directory to save backups in, must be rwx by postgres user | |
| BASE_DIR="/var/backups/postgres" | |
| YMD=$(date "+%Y-%m-%d") | |
| DIR="$BASE_DIR/$YMD" | |
| mkdir -p $DIR | |
| cd $DIR | |
| # make database backup |