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
| #!/usr/bin/env bash | |
| # Courtesy: https://stackoverflow.com/a/20686101 | |
| docker ps -a | grep -v CONTAINER | cut -d' ' -f1 | xargs docker inspect -f '{{.Config.Image}}{{"\t"}}{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' |
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
| #!/usr/bin/env bash | |
| # Courtesy: https://github.com/helm/helm/issues/2332#issuecomment-336565784 | |
| # Enhanced for performance | |
| TARGET_NUM_REVISIONS=10 | |
| TARGET_NUM_REVISIONS=$(($TARGET_NUM_REVISIONS+0)) | |
| RELEASES=$(kubectl --namespace=kube-system get cm -l OWNER=TILLER -o go-template --template='{{range .items}}{{ .metadata.labels.NAME }}{{"\n"}}{{ end }}' | sort -u) |
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
| #!/usr/bin/env bash | |
| for arn in $(aws elbv2 describe-load-balancers | jq -r '.LoadBalancers[] | select(.DNSName | contains("TODO_CHANGE_THIS")) | .LoadBalancerArn'); do | |
| echo "Updating: ${arn}" | |
| aws elbv2 modify-load-balancer-attributes --load-balancer-arn "${arn}" --attributes Key=deletion_protection.enabled,Value=false | |
| done |
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
| #!/usr/bin/env bash | |
| download_url=$(curl -s -H "Authorization: token ${GITHUB_ACCESS_TOKEN}" "https://api.github.com/repos/${GH_OWNER}/${GH_REPO}/releases/tags/v1.0.0" | jq '.assets[] | select( .name == "bin-name-v1.0.0-darwin-amd64")' | jq -r ".url") | |
| curl -Lo ssm-env -H "Authorization: token ${GITHUB_ACCESS_TOKEN}" -H "Accept: application/octet-stream" "${download_url}" |
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
| // Courtesy: https://dev.to/aletisunil/accepting-linkedin-invitations-through-javascript-2p0b | |
| var x = document.getElementsByClassName("invitation-card__action-btn artdeco-button artdeco-button--2 artdeco-button--secondary ember-view"); | |
| for(var i=0;i < x.length;i++){x[i].click();} |
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
| #!/usr/bin/env bash | |
| # install helm on OS X | |
| brew install helm | |
| # Add the bitnami charts location | |
| helm repo add bitnami https://charts.bitnami.com/bitnami | |
| # Show all the charts that bitnami manages | |
| helm search repo bitnami |
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
| VM_MEM=16 | |
| VM_NODES=$(kubectl top node --sort-by memory | grep -iv memory | wc -l) | |
| K8S_MEM=$(kubectl top node --sort-by memory | awk '{print $5}' | tr -d '%' | grep -iv memory | paste -s -d+ - | bc) | |
| echo "Cluster Memory: $(($VM_NODES*$VM_MEM*100/$K8S_MEM))%" |
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
| aws ec2 describe-addresses --filters "Name=tag:Environment,Values=qa" | jq -r '.Addresses[].PublicIp' |
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
| kubectl get secret app1 -o jsonpath="{.data.MYSQL_CONN}" | base64 --decode | |
| cs=$(echo -n "mysql://user:pass@host:port/db" | base64) | |
| kubectl patch secret app1 -p='{"data":{"MSQL_CONN": "'"${cs}"'"}}' -v=1 |
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
| #!/usr/bin/env bash | |
| # Create a container to shell into and run commands from | |
| kubectl run ryan-smith-test --rm -it --restart=Never --image=nginx -- bash | |
| # Create a container that is long lived and will restart | |
| kubectl run test-pod --image nginx | |
| kubectl -it exec test-pod bash | |
| ## run your commands | |
| # exit |