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
$ docker run --rm -it ubuntu bash | |
root@b327e1a0640b:/# function file_ends_with_newline() { | |
> [[ $(tail -c1 "$1" | wc -l) -gt 0 ]] | |
> } | |
root@b327e1a0640b:/# | |
root@b327e1a0640b:/# touch empty.txt | |
root@b327e1a0640b:/# | |
root@b327e1a0640b:/# | |
root@b327e1a0640b:/# file_ends_with_newline empty.txt && echo ends in newline || echo does NOT end in newline | |
does NOT end in newline |
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
#!/bin/bash | |
# | |
# Wrapper for any AWS-related command using aws that handles the 1 hour MFA token. | |
# | |
# Create an aws-role.config.json file in the same directory as this script that looks like: | |
# { | |
# "<your-profile-nickname>": { | |
# "profile": "<your-hub>", | |
# "region": "<your-default-region>", | |
# "mfa_arn": "<your-mfa-arn>", |
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
#!/bin/bash | |
# | |
# Wrapper for any AWS-related command using aws that handles the 1 hour MFA token. | |
# | |
# Create an aws-role.config.json file in the same directory as this script that looks like: | |
# { | |
# "spoke-account": { | |
# "profile": "hub", | |
# "region": "us-west-2", | |
# "mfa_arn": "<your-mfa-arn>", |
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
#!/bin/bash | |
set -e | |
unset AWS_ACCESS_KEY_ID | |
unset AWS_SECRET_ACCESS_KEY | |
unset AWS_SESSION_TOKEN | |
unset AWS_DEFAULT_REGION | |
unset AWS_DEFAULT_OUTPUT | |
unset AWS_PROFILE | |
unset AWS_CA_BUNDLE |
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
postgres=# SELECT version(); | |
version | |
--------------------------------------------------------------------------------------------------------------- | |
PostgreSQL 9.4.4 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44), 64-bit | |
(1 row) | |
postgres=# SELECT name, current_setting(name), SOURCE | |
postgres-# FROM pg_settings | |
postgres-# WHERE SOURCE NOT IN ('default', 'override'); | |
name | current_setting | source |
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
postgres=# SELECT version(); | |
version | |
--------------------------------------------------------------------------------------------------------------- | |
PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44), 64-bit | |
(1 row) | |
postgres=# SELECT name, current_setting(name), SOURCE | |
postgres-# FROM pg_settings | |
postgres-# WHERE SOURCE NOT IN ('default', 'override'); | |
name | current_setting | source |
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
SELECT | |
COALESCE(blockingl.relation::regclass::text,blockingl.locktype) as locked_item, | |
blockeda.procpid AS blocked_pid, | |
blockeda.current_query as blocked_query, | |
blockedl.mode as blocked_mode, | |
blockinga.procpid AS blocking_pid, | |
blockinga.current_query as blocking_query, | |
blockingl.mode as blocking_mode | |
FROM pg_catalog.pg_locks blockedl | |
JOIN pg_stat_activity blockeda ON blockedl.pid = blockeda.procpid |
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
psql (9.4.4) | |
Type "help" for help. | |
postgres=# | |
postgres=# SELECT name, current_setting(name), source | |
postgres-# FROM pg_settings | |
postgres-# WHERE source NOT IN ('default', 'override'); | |
name | current_setting | source | |
---------------------------------+----------------------------------+-------------------- | |
application_name | psql | client |
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
listen_addresses = '*' | |
port = 5432 | |
max_connections = 300 | |
shared_buffers = 2GB | |
work_mem = 10MB | |
maintenance_work_mem = 256MB | |
max_stack_depth = 8MB | |
wal_buffers = 16MB | |
checkpoint_segments = 32 | |
checkpoint_completion_target = .9 |
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
mydb=> SELECT name, current_setting(name), source | |
mydb-> FROM pg_settings | |
mydb-> WHERE source NOT IN ('default', 'override'); | |
name | current_setting | source | |
---------------------------------+------------------+-------------------- | |
application_name | psql | client | |
archive_command | exit 0 | configuration file | |
archive_mode | on | configuration file | |
autovacuum | on | configuration file | |
autovacuum_analyze_scale_factor | 0.1 | configuration file |
NewerOlder