mirror of
https://github.com/jbranchaud/til
synced 2026-01-20 15:38:02 +00:00
Compare commits
2 Commits
d6a4f08f30
...
d1bbbb8843
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1bbbb8843 | ||
|
|
84f4aa2edb |
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
|||||||
|
|
||||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||||
|
|
||||||
_1216 TILs and counting..._
|
_1218 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -612,6 +612,7 @@ _1216 TILs and counting..._
|
|||||||
- [Group By The Result Of A Function Call](postgres/group-by-the-result-of-a-function-call.md)
|
- [Group By The Result Of A Function Call](postgres/group-by-the-result-of-a-function-call.md)
|
||||||
- [Idempotent Inserts](postgres/idempotent-inserts.md)
|
- [Idempotent Inserts](postgres/idempotent-inserts.md)
|
||||||
- [Include All Queries In The Log File](postgres/include-all-queries-in-the-log-file.md)
|
- [Include All Queries In The Log File](postgres/include-all-queries-in-the-log-file.md)
|
||||||
|
- [Include Multiple Tables In A pg_dump](postgres/include-multiple-tables-in-a-pg-dump.md)
|
||||||
- [Insert A Bunch Of Records With Generate Series](postgres/insert-a-bunch-of-records-with-generate-series.md)
|
- [Insert A Bunch Of Records With Generate Series](postgres/insert-a-bunch-of-records-with-generate-series.md)
|
||||||
- [Insert Just The Defaults](postgres/insert-just-the-defaults.md)
|
- [Insert Just The Defaults](postgres/insert-just-the-defaults.md)
|
||||||
- [Inspect Progress Of Long-Running Create Index](postgres/inspect-progress-of-long-running-create-index.md)
|
- [Inspect Progress Of Long-Running Create Index](postgres/inspect-progress-of-long-running-create-index.md)
|
||||||
@@ -1157,6 +1158,7 @@ _1216 TILs and counting..._
|
|||||||
- [Do A Dry Run Of An rsync](unix/do-a-dry-run-of-an-rsync.md)
|
- [Do A Dry Run Of An rsync](unix/do-a-dry-run-of-an-rsync.md)
|
||||||
- [Do Not Overwrite Existing Files](unix/do-not-overwrite-existing-files.md)
|
- [Do Not Overwrite Existing Files](unix/do-not-overwrite-existing-files.md)
|
||||||
- [Enable Multi-Select Of Results With fzf](unix/enable-multi-select-of-results-with-fzf.md)
|
- [Enable Multi-Select Of Results With fzf](unix/enable-multi-select-of-results-with-fzf.md)
|
||||||
|
- [Exclude A Command From The ZSH History File](unix/exclude-a-command-from-the-zsh-history-file.md)
|
||||||
- [Exclude A Directory With Find](unix/exclude-a-directory-with-find.md)
|
- [Exclude A Directory With Find](unix/exclude-a-directory-with-find.md)
|
||||||
- [Exclude Certain Files From An rsync Run](unix/exclude-certain-files-from-an-rsync-run.md)
|
- [Exclude Certain Files From An rsync Run](unix/exclude-certain-files-from-an-rsync-run.md)
|
||||||
- [Figure Out The Week Of The Year From The Terminal](unix/figure-out-the-week-of-the-year-from-the-terminal.md)
|
- [Figure Out The Week Of The Year From The Terminal](unix/figure-out-the-week-of-the-year-from-the-terminal.md)
|
||||||
|
|||||||
26
postgres/include-multiple-tables-in-a-pg-dump.md
Normal file
26
postgres/include-multiple-tables-in-a-pg-dump.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Include Multiple Tables In A pg_dump
|
||||||
|
|
||||||
|
When the `pg_dump` command is given the `-t` flag, it will dump just the table
|
||||||
|
named with that flag. If you want to include multiple tables in the dump, you
|
||||||
|
just need to use the flag multiple times.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pg_dump -t users -t users_roles -t roles my_database > roles.dump.sql
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, you can specify a
|
||||||
|
[pattern](https://www.postgresql.org/docs/current/app-psql.html#APP-PSQL-PATTERNS)
|
||||||
|
when using the `-t` flag.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pg_dump -t 'users*|roles' my_database > roles.dump.sql
|
||||||
|
```
|
||||||
|
|
||||||
|
You have to be a little more mindful of what will and won't be included when
|
||||||
|
crafting a pattern. It is a nice shortcut for a well-known or well-constrained
|
||||||
|
data model.
|
||||||
|
|
||||||
|
See the [`pg_dump`
|
||||||
|
docs](https://www.postgresql.org/docs/current/app-pgdump.html) for more
|
||||||
|
details, as well as [some
|
||||||
|
examples](https://www.postgresql.org/docs/current/app-pgdump.html#PG-DUMP-EXAMPLES).
|
||||||
37
unix/exclude-a-command-from-the-zsh-history-file.md
Normal file
37
unix/exclude-a-command-from-the-zsh-history-file.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# Exclude A Command From The ZSH History File
|
||||||
|
|
||||||
|
The `zsh` shell can be configured to record the commands you run from the
|
||||||
|
terminal in a history file. This is great for recalling and retrieving past
|
||||||
|
commands that you want to run again.
|
||||||
|
|
||||||
|
What about commands that I don't want written to a file on my machine? For
|
||||||
|
instance, if I'm running a command that includes a password, secret key, or
|
||||||
|
some other sensitive value, I don't want that saved in plaintext on my machine.
|
||||||
|
|
||||||
|
`zsh` has an affordance for this with the `hist_ignore_space` option. With that
|
||||||
|
option enabled, any command preceded by a space (`' '`) will be excluded from
|
||||||
|
the history file.
|
||||||
|
|
||||||
|
First, turn it on.
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
$ setopt hist_ignore_space
|
||||||
|
```
|
||||||
|
|
||||||
|
Now, try a couple commands and see what shows up in the file.
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
$ echo 'this command will be saved in history'
|
||||||
|
this command will be saved in history
|
||||||
|
|
||||||
|
$ echo 'this will be kept secret'
|
||||||
|
this will be kept secret
|
||||||
|
|
||||||
|
$ tail ~/.zsh_history
|
||||||
|
: 1654378676:0;echo 'this command will be saved in history'
|
||||||
|
: 1654378690:0;tail ~/.zsh_history
|
||||||
|
```
|
||||||
|
|
||||||
|
Notice how the second command with the prefixed space is excluded.
|
||||||
|
|
||||||
|
[source](https://unix.stackexchange.com/a/6104/5916)
|
||||||
Reference in New Issue
Block a user