Last active
April 6, 2018 01:37
-
-
Save DownRangeDevOps/c48876a41e5b4f7c91c627307f01f1c6 to your computer and use it in GitHub Desktop.
Commands I usually forget until I need them
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
# AWS CLI | |
ec2 describe-instances | |
--filters "Name=tag:Environment,Values=staging" "Name=tag:Group,Values=wizard" \ | |
--query "Reservations[].Instances[].{Environment: Tags[?Key == 'Environment'].Value | [0], \ | |
Name: Tags[?Key == 'Name'].Value | [0], \ | |
ip: PrivateIpAddress}" --output table | |
sudo ntpdate pool.ntp.org #update system time | |
ssh-keygen -R hostname #remove a host from authorized_keys | |
# config stuff I forget | |
https://stackoverflow.com/a/42107711 # change bash coursor when using vi mode | |
# get eb env vars and prep them to be used with eb setenv | |
eb printenv youtily-stage | sed -e "s/^[ \t]*//;s/ = \(.*\)/='\1'/;/^Environment.*/d" | sort | |
# delete all Django migration files | |
find . -path *migrations* -name "*.py" -not -path "*__init__*" | xargs rm -f | |
# uninstall all pip modules | |
sudo pip freeze | sed -E 's/==.+//g' | xargs sudo pip uninstall -y | |
# uninstall all pip modules that are in requirements.txt | |
sudo pip uninstall -r requirements.txt | |
# rename directories | |
for d in $(ls); do mv $d $(echo $d | tr _ -); done | |
# get test coverage for the portal | |
coverage run --source='.' manage.py test -n &&\ | |
coverage report -m --omit="*/migrations*,*/__init__.py,*/wsgi.py, */test*" | |
# Fix hidden commit message window in SourceTree | |
defaults delete com.torusknot.SourceTreeNotMAS "NSSplitView Subview Frames repowindow_LogViewDescSplitter" | |
### Force delete all docker things | |
# To clear containers: | |
docker rm -f $(docker ps -a -q) | |
# To clear images: | |
docker rmi -f $(docker images -a -q) | |
# To clear volumes: | |
docker volume rm $(docker volume ls -q) | |
# To clear networks: | |
docker network rm $(docker network ls | tail -n+2 | awk '{if($2 !~ /bridge|none|host/){ print $1 }}') | |
# Use OpenSSL to encrypt/decrypt files | |
openssl enc -aes-256-cbc -salt -in <file> -out <file>.enc | |
openssl enc -aes-256-cbc -d -in <file>.enc -out <file> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment