This file contains hidden or 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 pull postgres | |
mkdir -p $HOME/docker/volumes/postgres_dh | |
docker run --rm --name pg-docker -e POSTGRES_PASSWORD=docker -d -p 5433:5432 -v $HOME/docker/volumes/postgres_dh:/var/lib/postgresql/data postgres |
This file contains hidden or 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
def _remap_dict(d, fromto_mapping, method='delete'): | |
""" | |
Remap dictionary keys from a certain set of keys to a new set of keys | |
:param d: the dictionary that needs to be remapped | |
:param fromto_mapping: a dictionary mapping of keys in the original dictionary to the output dictionary | |
:param method: what do do with keys that aren't found in the mapping | |
'delete' means that they will be removed from the output dictionary | |
'remain' means that they will have their original names in the output dictionary | |
:return: the output dictionary with keys remapped, will return None if method is not recognized | |
""" |
This file contains hidden or 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
import json | |
def to_bash_json(d): | |
return json.dumps({'i': json.dumps(d)})[6:-1] | |
if __name__ == '__main__': | |
S3_CREDS = { | |
"aws_access_key_id": "AKA", | |
"aws_secret_access_key": "CWW" |