Skip to content

Instantly share code, notes, and snippets.

@jimleroyer
Last active November 15, 2024 19:11
Show Gist options
  • Save jimleroyer/6d027a8ad3def140c4be874da312b8cc to your computer and use it in GitHub Desktop.
Save jimleroyer/6d027a8ad3def140c4be874da312b8cc to your computer and use it in GitHub Desktop.
description
[[Snippets]]
Description = "Scoop update and show status"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["scoop"]
command = "scoop update && scoop status"
[[Snippets]]
Description = "Cleaning up Scoop's installataions and cache."
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["scoop"]
command = "scoop cleanup * && scoop cache rm *"
[[Snippets]]
Description = "Creates a kubernetes pod yaml file"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["kubernetes", "yaml"]
command = "kubectl run <name> --image=<image=nginx> --port=<port=80> --dry-run=client -o yaml"
[[Snippets]]
Description = "Get currently running kubernetes pods"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["kubernetes"]
command = "kubectl get pods -o wide --context <context=prod>"
[[Snippets]]
Description = "Delete a Kubernetes resource"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["kubernetes"]
command = "kubectl delete -f <file>"
[[Snippets]]
Description = "Replaces a kubernetes resources"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["kubernetes"]
command = "kubectl replace --force -f <file>"
[[Snippets]]
Description = "Delete kubernetes pods"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["kubernetes"]
command = "kubectl delete pods <pods>"
[[Snippets]]
Description = "kubectl create deployment <name> --image=<image>"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["kubernetes"]
command = "Create a new Kubernetes deployment"
[[Snippets]]
Description = "See Kubernetes deployment rollout history"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["kubernetes"]
command = "kubectl rollout history deploy mynginx"
[[Snippets]]
Description = "Change image of Kubernetes deployment"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["kubernetes"]
command = "kubectl set image deployment <deployname> <image>"
[[Snippets]]
Description = "Undo a Kubernetes rollout to a specific revision number"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["kubernetes"]
command = "kubectl rollout undo deployment <deployname> --to-revision=<rev>"
[[Snippets]]
Description = "Scales a Kubernetes deployment to a number of minimum replica"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["kubernetes"]
command = "kubectl scale deploy <deployname> --replicas=<numreplica>"
[[Snippets]]
Description = "Display Kubernetes deployment, replicasets and pods for given app label"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["kubernetes"]
command = "kubectl get deploy,rs,po -l app=<apname> -o=wide --context <context=prod>"
[[Snippets]]
Description = "Generates a RSA 2048 bits private key with a given key name"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["rsa", "security", "ssl", "openssl"]
command = "c:\\Users\\jimle\\scoop\\apps\\git\\2.43.0\\usr\\bin\\openssl.exe genrsa -out <keyname>.key 2048"
[[Snippets]]
Description = "Generates a SSL certificate signing request from a given private key and common name"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["security", "ssl", "openssl"]
command = "c:\\Users\\jimle\\scoop\\apps\\git\\2.43.0\\usr\\bin\\openssl.exe req -new -key <keylocation> -out <csrname>.csr -subj \"/CN=<cn>/O=learner\""
[[Snippets]]
Description = "Encodes a certificate file into base64 encoding"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["security", "base64", "encoding"]
command = "certutil -encode <inputfile> <outputfile>"
[[Snippets]]
Description = "Decode a 64 base string"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["encoding", "base64"]
command = "[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String(<base64string>))"
[[Snippets]]
Description = "Exposes a Kubernetes deployment as a service with a NodePort service type"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["kubernetes"]
command = "kubectl expose deployment <name> --type=NodePort"
[[Snippets]]
Description = "Apply Kubernetes change with helm, for a given env and label"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["helm"]
command = "helmfile -e <env> -l <label> apply"
[[Snippets]]
Description = "Diff current Kubernetes changes detected by Helm for a given env and label"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["helm"]
command = "helmfile -e <env> -l <label> diff"
[[Snippets]]
Description = "Destroy Kubernetes resources via Heml for a given env and label"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["helm"]
command = "helmfile -e <env> -l <label> destroy"
[[Snippets]]
Description = "Get Kubernetes clusters"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["kubernetes"]
command = "kubectl config get-clusters"
[[Snippets]]
Description = "Perform a Terraform plan (via terragrunt) for a given var file"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["terraform"]
command = "terragrunt plan -var-file <var-file>"
[[Snippets]]
Description = "Perform a Terraform apply (via terragrunt) for a given var file"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["terraform"]
command = "terragrunt apply -var-file <var-file>"
[[Snippets]]
Description = "Perform a Terraform apply (via terragrunt) for a given target resource and var file"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["terraform"]
command = "terragrunt apply --target <target-resource> -var-file <var-file>"
[[Snippets]]
Description = "Prune dead remote branches"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["git"]
command = "git remote update --prune"
[[Snippets]]
Description = "Find local git branches with no remote counterpart"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["git"]
command = "for /f \"tokens=1,2\" %i in ('git branch --format \"%(refname:short) %(upstream)\"') do @if \"%j\"==\"\" echo %i"
[[Snippets]]
Description = "Delete all merged local branches reported back by remote (except main)"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["git"]
command = "git branch --merged | rg -v main | % { git branch -d $_.Trim() }"
[[Snippets]]
Description = "Report all local branches that were merged in remote"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["git"]
command = "git branch --merged"
[[Snippets]]
Description = "Creates a new git branch locally"
Filename = "C:\\Users\\jlr\\AppData\\Roaming\\pet\\snippet.toml"
Output = ""
Tag = ["git"]
command = "git checkout -b <newbranch>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment