Skip to content

Instantly share code, notes, and snippets.

View caffeinetiger's full-sized avatar

Tony Benavides caffeinetiger

  • Chromatic Ai Swarm
  • Earth
View GitHub Profile
@caffeinetiger
caffeinetiger / tar_a_directory.sh
Last active April 18, 2022 18:30
[nixCraft - How do I Compress a Whold Linux or UNIX Directory?](https://www.cyberciti.biz/faq/how-do-i-compress-a-whole-linux-or-unix-directory/) [nixCraft - Linux: tar Extract Files](https://www.cyberciti.biz/faq/tar-extract-linux/)
# Compress a directory
tar -zcvf archive-name.tar.gz directory-name
# Extract files
tar -xzvf file.tar.gz
aws eks update-kubeconfig --name example --profile named-profile
eksctl utils associate-iam-oidc-provider --cluster <cluster_name> --approve
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
#!/bin/bash
python3 -m venv /path/to/new/virtual/environment
@caffeinetiger
caffeinetiger / retagging_ecr_image.sh
Last active April 18, 2022 18:16
There is no user friendly way to retag an image in the AWS ECR Web Console. You need to use AWS CLI commands to accomplish this. - [Official AWS Documentation](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-retag.html) - [Stackoverflow
#!/bin/bash
# Get image manifest by tag
MANIFEST=$(aws ecr batch-get-image --repository-name amazonlinux --image-ids imageTag=latest --output json | jq --raw-output '.images[0].imageManifest')
# Or
# Get image manifest by digest (this is found on the ECR repo page in the AWS Web Console)
MANIFEST=$(aws ecr batch-get-image --repository-name amazonlinux --image-ids imageDigest=sha256:8e080763aa56a2d509f9614613019ff0d9fe9cfd651b2efdb8961356c9ea6e26 --query 'images[].imageManifest' --output text)
# Update image with new tag
aws ecr put-image --repository-name amazonlinux --image-tag previous.2018 --image-manifest "$MANIFEST"
#!/bin/bash
# Prune all unused images
docker image prune --all
# The filtering flag (--filter) format is of “key=value”. If there is more than one filter, then pass multiple flags
docker image prune --filter "foo=bar"
# For more details on the filter flag option see official documentation mentioned in the description
# Prune all unused images with no confirmation
#!/bin/bash
kubectl scale --replicas=0 deployment/<your-deployment>