From 374d381c00cf72d0169873bf0565f369bab6e699 Mon Sep 17 00:00:00 2001 From: npit Date: Sun, 28 May 2017 23:46:22 +0300 Subject: [PATCH 1/3] Update emacs --- cheat/cheatsheets/emacs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cheat/cheatsheets/emacs b/cheat/cheatsheets/emacs index 4201c0a..eb8e177 100644 --- a/cheat/cheatsheets/emacs +++ b/cheat/cheatsheets/emacs @@ -28,6 +28,16 @@ Select a buffer CTRL-x b Run command in the scratch buffer CTRL-x CTRL-e +# Navigation ( backward / forward ) + + Character-wise CTRL-b , CTRL-f + Word-wise ALT-b , ALT-f + Line-wise CTRL-p , CTRL-n + Sentence-wise ALT-a , ALT-e + Paragraph-wise ALT-{ , ALT-} + Function-wise CTRL-ALT-a , CTRL-ALT-e + Line beginning / end CTRL-a , CTRL-e + # Other stuff Open a shell ALT-x eshell From 2a6ec9cef521fb6fbf6100dd0b5842a72a15ce30 Mon Sep 17 00:00:00 2001 From: Astaroth Date: Thu, 29 Jun 2017 20:23:47 -0300 Subject: [PATCH 2/3] added psql commands --- cheat/cheatsheets/psql | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 cheat/cheatsheets/psql diff --git a/cheat/cheatsheets/psql b/cheat/cheatsheets/psql new file mode 100644 index 0000000..9d898d8 --- /dev/null +++ b/cheat/cheatsheets/psql @@ -0,0 +1,21 @@ +#psql is the PostgreSQL terminal interface. The following commands were tested on version 9.5. +#Connection options: +#-U username (if not specified current OS user is used). +#-p port. +#-h server hostname/address. + +#Connect to a specific database: +psql -U postgres -h serverAddress -d dbName + +#Get databases on a server: +psql -U postgres -h serverAddress --list + +#Execute sql query and save output to file: +#Add -t to get only rows as result. +psql -U postgres -d dbName -c 'select * from tableName;' -o 'fileName' + +Read commands from file: +psql -f fileName + +#Restore databases from file: +psql -f /fileName.backup postgres From 86ba22e7b8875fc633db32cbfa32b28f09bfa7c3 Mon Sep 17 00:00:00 2001 From: Astaroth Date: Fri, 30 Jun 2017 21:34:32 -0300 Subject: [PATCH 3/3] +html output --- cheat/cheatsheets/psql | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/cheat/cheatsheets/psql b/cheat/cheatsheets/psql index 9d898d8..89a545a 100644 --- a/cheat/cheatsheets/psql +++ b/cheat/cheatsheets/psql @@ -1,21 +1,26 @@ -#psql is the PostgreSQL terminal interface. The following commands were tested on version 9.5. -#Connection options: -#-U username (if not specified current OS user is used). -#-p port. -#-h server hostname/address. +# psql is the PostgreSQL terminal interface. The following commands were tested on version 9.5. +# Connection options: +# -U username (if not specified current OS user is used). +# -p port. +# -h server hostname/address. -#Connect to a specific database: +# Connect to a specific database: psql -U postgres -h serverAddress -d dbName -#Get databases on a server: +# Get databases on a server: psql -U postgres -h serverAddress --list -#Execute sql query and save output to file: -#Add -t to get only rows as result. -psql -U postgres -d dbName -c 'select * from tableName;' -o 'fileName' +# Execute sql query and save output to file: +psql -U postgres -d dbName -c 'select * from tableName;' -o fileName -Read commands from file: +# Execute query and get tabular html output: +psql -U postgres -d dbName -H -c 'select * from tableName;' + +# Execute query and save resulting rows to csv file: +psql -U postgres -d dbName -t -A -P fieldsep=',' -c 'select * from tableName;' -o fileName.csv + +# Read commands from file: psql -f fileName -#Restore databases from file: -psql -f /fileName.backup postgres +# Restore databases from file: +psql -f fileName.backup postgres