Skip to content

Instantly share code, notes, and snippets.

View wyllie's full-sized avatar

Andrew Wyllie wyllie

View GitHub Profile
@wyllie
wyllie / python.sh
Created June 20, 2018 19:59
Python Virtual Environment Config
# Python environment
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Projects
# Set up virtual wrapper env
source /usr/local/bin/virtualenvwrapper.sh
# for testing, set pytest to verbose by default
alias pytest='pytest -v'
@wyllie
wyllie / gist:f60e272f1ad871ad34c8d4feb75f1db8
Created June 1, 2018 12:06
Common Mongo cli commands
# these are some common mongodb cli commands
# Get help
MongoDB Enterprise > help
# get a list of databases
show dbs
# get list of collections
show collections
@wyllie
wyllie / gist:8f67b301a2325ea3d6b09affc1099b7b
Last active May 15, 2018 20:34
Copy MongoDB Atlas collection
# this will copy the collection 'my_original' to 'my_copy'
db.my_original.aggregate([{$match: {}}, {$out: "my_copy"}])
# to move the collection to another db within the same Atlas mongodb cluster
db.adminCommand({renameCollection: "my_db.my_copy", to: "other_db.other_name"})
@wyllie
wyllie / gist:82f029acf308c3ec1dd1138ccb10716e
Created March 6, 2018 16:56
AWS KMS encrypt/decrypt from CLI
# Get the key-id from KMS
% aws kms list-keys
# To encrypt some text:
% aws kms encrypt --key-id <KeyId> --plaintext <text to encrypt>
# To decrypt it:
% aws kms decrypt --ciphertext-blob fileb://<(echo <blob from encrypt step> | base64 -D) --output text --query Plaintext | base64 -D