Update cheatsheets

This commit is contained in:
ivuorinen
2025-01-05 00:19:08 +00:00
parent 2661ee0973
commit c41e4ca75d
5 changed files with 70 additions and 3 deletions

View File

@@ -10,8 +10,16 @@ source: https://github.com/tldr-pages/tldr.git
- Match a variable against string literals to decide which command to run:
`case {{$tocount}} in {{words}}) {{wc -w README}}; ;; {{lines}}) {{wc -l README}}; ;; esac`
`case {{$COUNTRULE}} in {{words}}) {{wc -w README}} ;; {{lines}}) {{wc -l README}} ;; esac`
- Combine patterns with |, use * as a fallback pattern:
`case {{$tocount}} in {{[wW]|words}}) {{wc -w README}}; ;; {{[lL]|lines}}) {{wc -l README}}; ;; *) {{echo "what?"}}; ;; esac`
`case {{$COUNTRULE}} in {{[wW]|words}}) {{wc -w README}} ;; {{[lL]|lines}}) {{wc -l README}} ;; *) {{echo "what?"}}; ;; esac`
- Allow matching multiple patterns:
`case {{$ANIMAL}} in {{cat}}) echo "It's a cat" ;;& {{cat|dog}}) echo "It's a cat or a dog" ;;& *) echo "Fallback" ;; esac`
- Continue to the next pattern's commands without checking the pattern:
`case {{$ANIMAL}} in {{cat}}) echo "It's a cat" ;& {{dog}}) echo "It's either a dog or cat fell through" ;& *) echo "Fallback" ;; esac`

View File

@@ -19,3 +19,11 @@ source: https://github.com/tldr-pages/tldr.git
- Return the number of installed fonts in your system:
`fc-list | wc -l`
- Return a list of installed fonts that support the language based on its locale code:
`fc-list :lang={{jp}}`
- Return a list of installed fonts that contain the glyph specified by its Unicode code-point:
`fc-list :charset={{f303}}`

View File

@@ -39,4 +39,4 @@ source: https://github.com/tldr-pages/tldr.git
- List all possible conditions (`test` is an alias to `[`; both are commonly used with `if`):
`man [`
`man test`

25
tldr/kubectl-wait Normal file
View File

@@ -0,0 +1,25 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# kubectl wait
> Wait for resource(s) to reach a certain state.
> More information: <https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#wait>.
- Wait for a deployment to become available:
`kubectl wait --for=condition=available deployment/{{deployment_name}}`
- Wait for all pods with a certain [l]abel to be ready:
`kubectl wait --for=condition=ready pod -l {{label_key}}={{label_value}}`
- Wait for a pod to be deleted:
`kubectl wait --for=delete pod {{pod_name}}`
- Wait for a job to complete, within 120 seconds (if the condition isn't met on time, the exit status will be unsuccessful):
`kubectl wait --for=condition=complete job/{{job_name}} --timeout 120s`

26
tldr/linux/scriptlive Normal file
View File

@@ -0,0 +1,26 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# scriptlive
> Execute a typescript created by the `script` command in real-time.
> See also: `script`.
> More information: <https://manned.org/scriptlive>.
- Execute a typescript in real-time:
`scriptlive {{path/to/timing_file}} {{path/to/typescript}}`
- Execute a typescript at double the original speed:
`scriptlive {{path/to/timing_file}} {{path/to/typescript}} --divisor 2`
- Execute a typescript created using `--log-in` option of `script`:
`scriptlive --log-in {{path/to/stdin_log_file}} {{path/to/typescript}}`
- Execute a typescript waiting at most 2 seconds between each command:
`scriptlive {{path/to/timing_file}} {{path/to/typescript}} --maxdelay 2`