-
pg_dump is a nifty utility designed to output a series of SQL statements that describes the schema and data of your database. You can control what goes into your backup by using additional flags.
Backup:pg_dump -h localhost -p 5432 -U postgres -d mydb > backup.sql
Restore:
psql -h localhost -p 5432 -U postgres -d mydb < backup.sql
-h is for host.
-p is for port.
-U is for username.
-d is for database.
This file contains 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
python3 -m cProfile -s cumulative script.py > profile.txt |
This file contains 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
''' | |
To save python objects of any sort, to a file. | |
''' | |
import pickle as pkl | |
pkl.dump( fig, open('FigureObject.pickle', 'wb') ) | |
pkl.dump( fig, open('FigureObject.pickle', 'wb'), fix_imports=True ) # fix_imports makes it py2x compatible - untested | |
''' | |
Load python objects from file |
This file contains 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
# coding: utf-8 | |
"""Juego de la vida de Conway. | |
Autor: Juan Luis Cano <[email protected]> | |
El tablero es un array de NumPy, donde 0 significa célula muerta y 1 célula | |
viva. Se muestra una animación con matplotlib. | |
""" |